-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't inherit handles by buckd on Windows
Summary: When test runner waits for `buck2` process it hangs because buckd process is still running. This happens because buckd inherits handles from parent process and wait on the parent process awaits for these handles to be closed. Example: https://stackoverflow.com/questions/13243807/popen-waiting-for-child-process-even-when-the-immediate-child-has-terminated `Popen` in Python has `close_fds` argument to solve this: > On Windows, if close_fds is true then no handles will be inherited by the child process unless explicitly passed in the handle_list element of STARTUPINFO.lpAttributeList, or by standard handle redirection. https://docs.python.org/3/library/subprocess.html Rust sets `bInheritHandles` to `TRUE` unconditionally: https://github.com/rust-lang/rust/blob/acb5c16fa8acf7fd3b48fc218881f006577bab1a/library/std/src/sys/windows/process.rs#L327 There are several open issues related to this: - rust-lang/rust#54760 - rust-lang/rust#38227 Because of that we have to call `CreateProcessW` ourselves. Implementation is inspired by: - std library: https://github.com/rust-lang/rust/blob/master/library/std/src/sys/windows/process.rs - subprocess library: https://github.com/hniksic/rust-subprocess/blob/master/src/win32.rs - docs for `CreateProcessW`: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw Reviewed By: stepancheg Differential Revision: D36663797 fbshipit-source-id: 14431002a763042f9c160b8a7ff7f8a62dd6befa
- Loading branch information
1 parent
590acf4
commit 6ca165b
Showing
1 changed file
with
170 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters