git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH] Don't log TransportGitSsh error stream to JVM stderr

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 7, 2009, 22:31 UTC
Message-ID
<1244413884-17241-1-git-send-email-spearce@spearce.org>

This is an API function, not a user interface routine. We should not be printing messages from the remote side to our console. Instead we should buffer them, and allow a TransportException to be thrown which contains the message data. Higher level user interface routines can then catch that exception, and display the message, if any, in a form that is appropriate to the context.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../spearce/jgit/transport/TransportGitSsh.java    |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
index 2e9e0be..de72d02 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
@@ -166,17 +166,14 @@ public String toString() {
 			@Override
 			public void write(final int b) throws IOException {
 				if (b == '\r') {
-					System.err.print('\r');
 					return;
 				}
 
 				sb.append((char) b);
 
 				if (b == '\n') {
-					final String line = sb.toString();
-					System.err.print(line);
-					all.append(line);
-					sb = new StringBuilder();
+					all.append(sb);
+					sb.setLength(0);
 				}
 			}
 		};
-- 
1.6.3.2.322.g117de
Message 1 of 1 in “Don't log TransportGitSsh error stream to JVM stderr”
  1. Don't log TransportGitSsh error stream to JVM stderrShawn O. Pearce, Jun 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.