[8.x] Bugfix passing errorlevel when command is run in background #37479
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.
Hi Taylor,
Thanks for taking the time to look into #37423.
I guess it depends whether the callbacks are considered to only serve as event hooks (as you described in docs), or as part of the process. The proposed fix would of course differ from the behaviour of scheduled commands on Linux and on Windows when not executed in the background. And that is at least unwanted i guess.
Today I've spent a few hours to make it work, and came across a few particularities on my way (all tests started with
schedule:run
with a few commands due to start)./v
to the command to signal the use of delayed expansion for the!ERRORLEVEL!
variable. The commandline as passed to the Symfony Process component works when ran in a terminalcmd
itself which makes it necessary to escape the exclamations. (^!ERRORLEVEL^!
)schedule:run
is called.I was stunned until I discovered that when the
handle
method returns an exit code instead of a thrown Exception it does work. So as long as the developer does something like this, it works:Notice that there are no quotes around the ^!ERRORLEVEL^! as this will not work..