Fix empty command tasks not terminating by improving _isTaskEmpty logic #251115
+53
−1
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.
Tasks with empty command strings (
"command": ""
) were not terminating properly, causing them to run indefinitely with a progress indicator that never completed.Root Cause
The
_isTaskEmpty()
method inTerminalTaskSystem
was checking(task.command.name !== undefined)
but not validating if the command was actually meaningful. Empty string commands were considered "not empty" because"" !== undefined
istrue
, causing them to be processed as valid tasks that attempt terminal execution.Fix
Modified
_isTaskEmpty()
to useCommandString.value()
and check for non-empty trimmed content:Behavior After Fix
Empty command tasks now:
TaskEventKind.End
event immediatelyPromise.resolve({ exitCode: 0 })
without starting a terminal processTest Case
This configuration from the original issue now works correctly:
The task terminates immediately instead of hanging indefinitely.
Fixes #173842.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
electronjs.org
node-gyp
(dns block)If you need me to access, download, or install something from one of these locations, you can either: