diff options
Diffstat (limited to 'compat/winansi.c')
-rw-r--r-- | compat/winansi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compat/winansi.c b/compat/winansi.c index a11a0f16d2..f4f08237f9 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -474,6 +474,18 @@ static void die_lasterr(const char *fmt, ...) va_end(params); } +#undef dup2 +int winansi_dup2(int oldfd, int newfd) +{ + int ret = dup2(oldfd, newfd); + + if (!ret && newfd >= 0 && newfd <= 2) + fd_is_interactive[newfd] = oldfd < 0 || oldfd > 2 ? + 0 : fd_is_interactive[oldfd]; + + return ret; +} + static HANDLE duplicate_handle(HANDLE hnd) { HANDLE hresult, hproc = GetCurrentProcess(); |