Skip to content

Refactor command result handling (fix #255503)#301995

Open
dimateos wants to merge 1 commit intomicrosoft:mainfrom
dimateos:patch-1
Open

Refactor command result handling (fix #255503)#301995
dimateos wants to merge 1 commit intomicrosoft:mainfrom
dimateos:patch-1

Conversation

@dimateos
Copy link

Refactor suggested to fix regression pointed out in #255503 and rioj7/command-variable#114

This should allow again the user to cancel commands/tasks/launchs when an invoked input is cancelled.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors ${input} command input result handling in the configuration resolver so that commands can signal “user canceled” by returning undefined/null, restoring the ability to abandon tasks/debug/launch flows (fixes #255503 regression).

Changes:

  • Treat undefined/null returned from an inputs[].type: "command" command as cancellation (return undefined), instead of a valid resolved input.
  • Keep the existing error path for non-string, non-nullish command results.

Comment on lines 342 to +347
return this.userInputAccessQueue.queue(() => this.commandService.executeCommand<string>(info.command, info.args)).then(result => {
if (typeof result === 'string' || Types.isUndefinedOrNull(result)) {
if (typeof result === 'string') {
return { value: result, input: info };
}
if (Types.isUndefinedOrNull(result)) {
return undefined;
Comment on lines +343 to 349
if (typeof result === 'string') {
return { value: result, input: info };
}
if (Types.isUndefinedOrNull(result)) {
return undefined;
}
throw new VariableError(VariableKind.Input, localize('inputVariable.command.noStringType', "Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.", variable, info.command));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants