mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Enhance the dup-dance in wt-status to work around t7502-commit.sh hang
Seems like Windows has some problems if you do too much dup()ing around. Work around these problems by dup()ing yet one more time. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -321,15 +321,17 @@ static void wt_status_print_untracked(struct wt_status *s)
|
||||
static void wt_status_print_verbose(struct wt_status *s)
|
||||
{
|
||||
struct rev_info rev;
|
||||
int saved_stdout;
|
||||
int saved_stdout, redirected_stdout;
|
||||
|
||||
fflush(s->fp);
|
||||
|
||||
/* Sigh, the entire diff machinery is hardcoded to output to
|
||||
* stdout. Do the dup-dance...*/
|
||||
saved_stdout = dup(STDOUT_FILENO);
|
||||
if (saved_stdout < 0 ||dup2(fileno(s->fp), STDOUT_FILENO) < 0)
|
||||
redirected_stdout = dup(fileno(s->fp));
|
||||
if (saved_stdout < 0 || dup2(redirected_stdout, STDOUT_FILENO) < 0)
|
||||
die("couldn't redirect stdout\n");
|
||||
close(redirected_stdout);
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
setup_revisions(0, NULL, &rev, s->reference);
|
||||
|
||||
Reference in New Issue
Block a user