diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:14:58 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:14:58 -0800 |
commit | d515fe08fc188ed5a23537a8218a32caf716ff49 (patch) | |
tree | cc6b003b3920b73a8810698cc0dd3ebb6ec49140 /compat | |
parent | 307de75c4893daa53895db26d389dc6f5e07c2c6 (diff) | |
parent | 1d3f065e0e4090a78640642cc1c1a3ce91d7852a (diff) | |
download | git-d515fe08fc188ed5a23537a8218a32caf716ff49.tar.gz git-d515fe08fc188ed5a23537a8218a32caf716ff49.tar.xz |
Merge branch 'js/mingw-isatty'
An update to a topic that is already in 'master'.
* js/mingw-isatty:
mingw: follow-up to "replace isatty() hack"
Diffstat (limited to 'compat')
-rw-r--r-- | compat/winansi.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compat/winansi.c b/compat/winansi.c index 3c9ed3cfe..82b89ab13 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -494,19 +494,16 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle) * It is because of this implicit close() that we created the * copy of the original. * - * Note that the OS can recycle HANDLE (numbers) just like it - * recycles fd (numbers), so we must update the cached value - * of "console". You can use GetFileType() to see that - * handle and _get_osfhandle(fd) may have the same number - * value, but they refer to different actual files now. + * Note that we need to update the cached console handle to the + * duplicated one because the dup2() call will implicitly close + * the original one. * * Note that dup2() when given target := {0,1,2} will also * call SetStdHandle(), so we don't need to worry about that. */ - dup2(new_fd, fd); if (console == handle) console = duplicate; - handle = INVALID_HANDLE_VALUE; + dup2(new_fd, fd); /* Close the temp fd. This explicitly closes "new_handle" * (because it has been associated with it). |