Repository navigation
Substitute an args file before wrapping a run in a shell - #2533
Merged
Merged
Conversation
robknopf
force-pushed
the
pr/dorun-argsfile-shell
branch
from
November 29, 2026 03:16
b3ff873 to
f5aa2bf
Compare
DoRun builds the shell invocation for .ShellCommand, setting cmd.exe and '/s /c "<exe> <args>"', and then the args file block below it overwrites the arguments with '@tempfile'. cmd.exe is left with no '/c', so it opens an interactive prompt and the build waits on it forever. The two have never been combinable; nothing set .ShellCommand until now, so nothing hit it. The substitution now happens first, into 'effArgs', and the shell and batch wrappings consume that, giving 'cmd /s /c "<exe> @tempfile"'. Behaviour without .ShellCommand or .BatchCommand is unchanged: the same arguments are set from the same inputs, just earlier. Also deletes the previous mTempFileName in the batch branch before replacing it, which the args file branch already did and which leaked otherwise.
robknopf
force-pushed
the
pr/dorun-argsfile-shell
branch
from
November 30, 2026 14:38
f5aa2bf to
27c0423
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DoRunbuilds the.ShellCommandinvocation, setting the file name tocmd.exeand the arguments to/s /c "<exe> <args>":and then the args file block below it overwrites those arguments:
cmd.exeis left with@tempfileand no/c, so it opens an interactive prompt and waits on it. The run never completes and the build hangs, since the execution is only considered finished once the process exits and its reader threads end.The two have never been combinable. Nothing currently passes
.ShellCommand, so nothing has hit it, but anything that did would hit it immediately for real workloads:cArgFileThresholdis 8191, and a link line long enough to matter is well past that.This moves the substitution ahead of the wrapping, into
effArgs, and has the shell and batch branches consume that — givingcmd /s /c "<exe> @tempfile". Without.ShellCommandor.BatchCommandthe behaviour is unchanged: the same arguments are computed from the same inputs, just earlier.The batch branch also now deletes the previous
mTempFileNamebefore replacing it, which the args file branch already did and which otherwise leaks when both apply.Verified
On Linux,
IDEHelper/Tests143/143 and theIDE/Tests/Test1IDE suite 41/41. That exercises it fairly hard, since every link, everyPreBuildCmdsexec and every test process goes through this path.I found it while making the wasm link able to use an emsdk that ships
emcc.batrather thanemcc.exe, which needs a shell to launch. That change is separate and I will put it up once this is settled, so the two cannot land in the wrong order.