Skip to content

Commit

Permalink
Cmd doesn't like escaped strings, so switch to strong quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
danegsta committed Dec 18, 2024
1 parent c40e371 commit 2a2c08f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/commands/selectCommandTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { IActionContext, IAzureQuickPickItem, IAzureQuickPickOptions, UserCancelledError } from '@microsoft/vscode-azext-utils';
import { escaped, PortBinding, VoidCommandResponse } from '@microsoft/vscode-container-client';
import { PortBinding, quoted, VoidCommandResponse } from '@microsoft/vscode-container-client';
import * as vscode from 'vscode';
import { ext } from '../extensionVariables';
import { isDockerComposeClient } from '../runtimes/OrchestratorRuntimeManager';
Expand Down Expand Up @@ -187,12 +187,12 @@ export async function selectCommandTemplate(
// For the default command, we can make assumptions that allow us to parse into command + args for better shell support

const argsRegex = /(?:"[^"]*")|(?:[^"\s]*)/g;
const commandAndArgs = resolvedCommand.match(argsRegex).filter(arg => arg.length !== 0).map(arg => arg.replace(/"/g, ''));
const commandAndArgs = resolvedCommand.match(argsRegex).filter(arg => arg.length !== 0);
if (commandAndArgs.length > 0) {
resolvedCommand = commandAndArgs[0];
resolvedCommand = commandAndArgs[0].replace(/"/g, '');
}

const resolvedArgs = commandAndArgs.slice(1).map(escaped);
const resolvedArgs = commandAndArgs.slice(1).map(arg => arg.startsWith('"') ? quoted(arg.replace(/"/g, '')) : arg);

return {
command: resolvedCommand,
Expand Down

0 comments on commit 2a2c08f

Please sign in to comment.