{"action":"closed","issue":{"url":"https://api.github.com/repos/git-for-windows/git/issues/833","repository_url":"https://api.github.com/repos/git-for-windows/git","labels_url":"https://api.github.com/repos/git-for-windows/git/issues/833/labels{/name}","comments_url":"https://api.github.com/repos/git-for-windows/git/issues/833/comments","events_url":"https://api.github.com/repos/git-for-windows/git/issues/833/events","html_url":"https://github.com/git-for-windows/git/issues/833","id":167408592,"number":833,"title":"_isatty and file handle redirection in native applications in bash","user":{"login":"dashesy","id":873905,"avatar_url":"https://avatars.githubusercontent.com/u/873905?v=3","gravatar_id":"","url":"https://api.github.com/users/dashesy","html_url":"https://github.com/dashesy","followers_url":"https://api.github.com/users/dashesy/followers","following_url":"https://api.github.com/users/dashesy/following{/other_user}","gists_url":"https://api.github.com/users/dashesy/gists{/gist_id}","starred_url":"https://api.github.com/users/dashesy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dashesy/subscriptions","organizations_url":"https://api.github.com/users/dashesy/orgs","repos_url":"https://api.github.com/users/dashesy/repos","events_url":"https://api.github.com/users/dashesy/events{/privacy}","received_events_url":"https://api.github.com/users/dashesy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-25T16:26:38Z","updated_at":"2016-07-26T11:33:46Z","closed_at":"2016-07-26T11:33:46Z","body":"I am using 64bit GitBash on Windows 10, default settings\r\n\r\n$ git --version\r\ngit version 2.9.0.windows.1\r\n\r\nThis is a native application\r\n\r\n```c\r\n    #include <stdio.h>\r\n    #include <io.h>\r\n    #include <memory>\r\n\r\n    int main() {\r\n        if (_isatty(_fileno(stdout)))\r\n            printf(\"stdout is tty\\n\");\r\n        if (_isatty(_fileno(stdout)))\r\n            printf(\"stderr is tty\\n\");\r\n        return 0;\r\n    }\r\n```\r\n\r\nBoth statements are printed on `cmd.exe` but not in bash. \r\nI also tried `_dup2` and redirection with file handles above 2, e.g. `3>&1` and it did not work as expected. Is this use-case something common? should I use named pipes instead? If yes, what is the purpose of `_dup2` on Windows?\r\n\r\nI think [this commit](https://github.com/git-for-windows/git/commit/de0d35dbabf220e47d50e5af7e7c5e9cbe977a13) is very much related to my question. Similar to`MSYS_TTY_HANDLES`, is there any environment variable that emulate file handle 3 in `3>&1`? "}}
{"actor":{"display_login":"dscho"}}