mirror of
https://github.com/git/git.git
synced 2026-01-17 22:26:32 +00:00
Merge branch 'mingw-isatty-and-dup2'
In December 2016 and January 2017, we revamped the Windows-specific `isatty()` handling, replacing a hack by a more robust solution. This patch is a follow-up we realized was necessary already in March 2017, but forgot to contribute to core Git yet. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -417,6 +417,9 @@ int mingw_raise(int sig);
|
||||
int winansi_isatty(int fd);
|
||||
#define isatty winansi_isatty
|
||||
|
||||
int winansi_dup2(int oldfd, int newfd);
|
||||
#define dup2 winansi_dup2
|
||||
|
||||
void winansi_init(void);
|
||||
HANDLE winansi_get_osfhandle(int fd);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user