With this option, stderr is redirected to stdout. The short option is '-2'. Alternatively, you can say '--redirect-stderr=<filename>' to redirect stderr to a file. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- On Tue, 29 May 2007, Shawn O. Pearce wrote: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote: > > > > BTW Almost any operation I run in git-gui fails, because cat > > is not found. > > That's the stuff that goes into a console and dumps both to > stdout and stderr. E.g. fetch, push, "compress database". > > The issue is Tcl doesn't give me a way to get a pipe to both > stdout and stderr. I cannot get two pipes, nor can I get a > single pipe with both stdout+stderr redirected to that pipe. > Unless I pipe it into another process. Enter `cat`. > > Would we consider a "--stderr-to-stdout" long option to git > itself? Then I could have git-gui do: > > git --stderr-to-stdout fetch > > and bypass the pipe into cat. Yes, I know, its crap. Welcome > to Tcl. How about this? git.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/git.c b/git.c index 53d81e9..72e0539 100644 --- a/git.c +++ b/git.c @@ -82,6 +82,20 @@ static int handle_options(const char*** argv, int* argc) } else if (!strcmp(cmd, "--bare")) { static char git_dir[PATH_MAX+1]; setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 1); + } else if (!strcmp(cmd, "-2") || + !strcmp(cmd, "--redirect-stderr")) { + if (dup2(1, 2) < 0) + return error("Could not redirect stderr: %s", + strerror(errno)); + } else if (!prefixcmp(cmd, "--redirect-stderr=")) { + int fd = open(cmd + 18, O_WRONLY | O_CREAT, 0777), ret; + if (fd < 0) + return error("Could not open %s", cmd + 18); + ret = dup2(fd, 2); + close(fd); + if (ret < 0) + return error("Could not redirect stderr: %s", + strerror(errno)); } else { fprintf(stderr, "Unknown option: %s\n", cmd); usage(git_usage_string); -- 1.5.2.2642.gc8bae-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html