-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the use of process substitution in wine-msvc wrapper #73
Conversation
Can you explain how this works? Does https://www.gnu.org/software/bash/manual/bash.html#index-wait
This feels a bit vague - does this mean all background jobs that bash itself has launched, or all grandchild processes that might have been launched? But I guess if this works for you as expected, then this does wait for all potential grandchild processes, somehow. Can you give more context about in which concrete cases this issue happens? I guess one potential case is when e.g. |
The problem is caused by process substitution launched by A simple example to demostrate the problem: $ sh -c "echo >(sleep 1 && echo hello)" > a.tmp && cat a.tmp && echo "after 1s" && sleep 1 && cat a.tmp
/dev/fd/63
after 1s
/dev/fd/63
hello The two $ sh -c "echo >(sleep 1 && echo hello); wait" > a.tmp && cat a.tmp
/dev/fd/63
hello Back to the case of |
Regarding the
It only waits for background jobs that the script itself has launched, not including grandchildren. But does
Based on the tests, I would like to remove the |
That sounds reasonable. The script is already somewhat complex, and the process substitution codepath, while neat, is quite hard to understand in all the minute details. So if we both make the code simpler to understand, and avoid this whole issue, that sounds good to me. |
Some tools may redirect stdout/stderr to files and wait for wine-msvc to exit, and then immediately start to process those files. But subprocesses may be still processing data after wine-msvc exits. Waiting for subprocesses to finish before exiting wine-msvc ensures all data are written to files and the tools get complete data. Waiting for subprocesses without msvctricks.exe will always hang if wine is not launched once before. Waiting for all process substitution is only available since Bash 5.1. So this commit simply removed the use of process substitution and only relies on FIFO.
Reworked PR and modified title and commit message. |
LGTM, thanks! |
Some tools may redirect stdout/stderr to files and wait for wine-msvc to exit, and then immediately start to process those files. But subprocesses may be still processing data after wine-msvc exits.
Waiting for subprocesses to finish before exiting wine-msvc ensures all data are written to files and the tools get complete data.
Waiting for subprocesses without msvctricks.exe will always hang if wine is not launched once before.
ccache
is such a tool that waiting for wine-msvc to exit. I observed thatccache
got truncated data when the outputs of/showIncludes
are large.CMake waits for stdout/stderr reaching EOF, so the issue does not happen for CMake.
Edit: Waiting for all process substitution is only available since Bash 5.1. So this commit simply removed the use of process substitution and only relies on FIFO.