mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
Replace spawn shell option with explicit shell args to avoid DEP0190 warning
This commit is contained in:
parent
0681c71894
commit
a8ccd7b6fb
5 changed files with 27 additions and 16 deletions
|
|
@ -241,9 +241,12 @@ describe('handleAutoUpdate', () => {
|
|||
handleAutoUpdate(mockUpdateInfo, mockSettings, '/root', mockSpawn);
|
||||
|
||||
expect(mockSpawn).toHaveBeenCalledWith(
|
||||
'npm i -g @qwen-code/qwen-code@nightly',
|
||||
expect.stringMatching(/^(bash|cmd\.exe)$/),
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/^(-c|\/c)$/),
|
||||
'npm i -g @qwen-code/qwen-code@nightly',
|
||||
]),
|
||||
{
|
||||
shell: true,
|
||||
stdio: 'pipe',
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import type { HistoryItem } from '../ui/types.js';
|
|||
import { MessageType } from '../ui/types.js';
|
||||
import { spawnWrapper } from './spawnWrapper.js';
|
||||
import type { spawn } from 'node:child_process';
|
||||
import os from 'node:os';
|
||||
|
||||
export function handleAutoUpdate(
|
||||
info: UpdateObject | null,
|
||||
|
|
@ -53,7 +54,10 @@ export function handleAutoUpdate(
|
|||
'@latest',
|
||||
isNightly ? '@nightly' : `@${info.update.latest}`,
|
||||
);
|
||||
const updateProcess = spawnFn(updateCommand, { stdio: 'pipe', shell: true });
|
||||
const isWindows = os.platform() === 'win32';
|
||||
const shell = isWindows ? 'cmd.exe' : 'bash';
|
||||
const shellArgs = isWindows ? ['/c', updateCommand] : ['-c', updateCommand];
|
||||
const updateProcess = spawnFn(shell, shellArgs, { stdio: 'pipe' });
|
||||
let errorOutput = '';
|
||||
updateProcess.stderr.on('data', (data) => {
|
||||
errorOutput += data.toString();
|
||||
|
|
|
|||
|
|
@ -291,9 +291,8 @@ export async function start_sandbox(
|
|||
sandboxEnv['NO_PROXY'] = noProxy;
|
||||
sandboxEnv['no_proxy'] = noProxy;
|
||||
}
|
||||
proxyProcess = spawn(proxyCommand, {
|
||||
proxyProcess = spawn('bash', ['-c', proxyCommand], {
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
shell: true,
|
||||
detached: true,
|
||||
});
|
||||
// install handlers to stop proxy on exit/signal
|
||||
|
|
@ -781,9 +780,13 @@ export async function start_sandbox(
|
|||
if (proxyCommand) {
|
||||
// run proxyCommand in its own container
|
||||
const proxyContainerCommand = `${config.command} run --rm --init ${userFlag} --name ${SANDBOX_PROXY_NAME} --network ${SANDBOX_PROXY_NAME} -p 8877:8877 -v ${process.cwd()}:${workdir} --workdir ${workdir} ${image} ${proxyCommand}`;
|
||||
proxyProcess = spawn(proxyContainerCommand, {
|
||||
const isWindows = os.platform() === 'win32';
|
||||
const proxyShell = isWindows ? 'cmd.exe' : 'bash';
|
||||
const proxyShellArgs = isWindows
|
||||
? ['/c', proxyContainerCommand]
|
||||
: ['-c', proxyContainerCommand];
|
||||
proxyProcess = spawn(proxyShell, proxyShellArgs, {
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
shell: true,
|
||||
detached: true,
|
||||
});
|
||||
// install handlers to stop proxy on exit/signal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue