Fix shell argument parsing in windows (#7160)
This commit is contained in:
parent
f2092b1ebc
commit
19f2a07efa
2 changed files with 3 additions and 2 deletions
|
|
@ -290,7 +290,7 @@ describe('ShellExecutionService', () => {
|
||||||
|
|
||||||
expect(mockPtySpawn).toHaveBeenCalledWith(
|
expect(mockPtySpawn).toHaveBeenCalledWith(
|
||||||
'cmd.exe',
|
'cmd.exe',
|
||||||
['/c', 'dir "foo bar"'],
|
'/c dir "foo bar"',
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ export class ShellExecutionService {
|
||||||
const child = cpSpawn(commandToExecute, [], {
|
const child = cpSpawn(commandToExecute, [], {
|
||||||
cwd,
|
cwd,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
|
windowsVerbatimArguments: true,
|
||||||
shell: isWindows ? true : 'bash',
|
shell: isWindows ? true : 'bash',
|
||||||
detached: !isWindows,
|
detached: !isWindows,
|
||||||
env: {
|
env: {
|
||||||
|
|
@ -322,7 +323,7 @@ export class ShellExecutionService {
|
||||||
const isWindows = os.platform() === 'win32';
|
const isWindows = os.platform() === 'win32';
|
||||||
const shell = isWindows ? 'cmd.exe' : 'bash';
|
const shell = isWindows ? 'cmd.exe' : 'bash';
|
||||||
const args = isWindows
|
const args = isWindows
|
||||||
? ['/c', commandToExecute]
|
? `/c ${commandToExecute}`
|
||||||
: ['-c', commandToExecute];
|
: ['-c', commandToExecute];
|
||||||
|
|
||||||
const ptyProcess = ptyInfo?.module.spawn(shell, args, {
|
const ptyProcess = ptyInfo?.module.spawn(shell, args, {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue