digitalmars.D.bugs - [Issue 16686] New: Can not spawn subprocess and read from File at
- via Digitalmars-d-bugs (28/28) Nov 14 2016 https://issues.dlang.org/show_bug.cgi?id=16686
https://issues.dlang.org/show_bug.cgi?id=16686 Issue ID: 16686 Summary: Can not spawn subprocess and read from File at same time Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: andrepuel gmail.com Created attachment 1622 --> https://issues.dlang.org/attachment.cgi?id=1622&action=edit Script that reproduces the problem In OSX, the implementation of the C function read() as well as the C function fileno() will invoke flockfile on the given argument. The function `spawnProcessImpl` from the `std.process` module tries to extract the fileno from the three File that are passed (stdin, stdout and stderr), if one of this files is busy doing read() in another thread, then the subprocess will not be launched until the read() is fulfilled and the file is unlocked. Attached is a simple code that demonstrates the issue. A read in stdin is done in the main thread, while a secondary thread tries to execute a ls. Due to the bug, the ls result will be available only after the user inputs a line in the stdin. --
Nov 14 2016