diff options
author | Evan Martin <martine@danga.com> | 2012-03-13 23:37:53 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-03-13 23:37:53 (GMT) |
commit | fdec96f54e92d2990ebf1ba5434b317d3d8ad49d (patch) | |
tree | 10f82c67c7680b3c74e014a79b343d74ed4e381a /src | |
parent | 898d2f20f9690a853e4b71e5b223dc18f324508c (diff) | |
parent | 4548ee03f1e6495751dfe31fa2bf416819257ce4 (diff) | |
download | Ninja-fdec96f54e92d2990ebf1ba5434b317d3d8ad49d.zip Ninja-fdec96f54e92d2990ebf1ba5434b317d3d8ad49d.tar.gz Ninja-fdec96f54e92d2990ebf1ba5434b317d3d8ad49d.tar.bz2 |
Merge pull request #250 from qhuo/SetCloseOnExec-for-Windows
Add a Windows version of SetCloseOnExec()
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util.cc b/src/util.cc index 02be994..4d9adf3 100644 --- a/src/util.cc +++ b/src/util.cc @@ -197,9 +197,10 @@ void SetCloseOnExec(int fd) { perror("fcntl(F_SETFD)"); } #else - // On Windows, handles must be explicitly marked to be passed to a - // spawned process, so there's nothing to do here. - NINJA_UNUSED_ARG(fd); + HANDLE hd = (HANDLE) _get_osfhandle(fd); + if (! SetHandleInformation(hd, HANDLE_FLAG_INHERIT, 0)) { + fprintf(stderr, "SetHandleInformation(): %s", GetLastErrorString().c_str()); + } #endif // ! _WIN32 } |