mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix exit code for shell mode also (#466)
This commit is contained in:
@@ -155,7 +155,7 @@ describe('useShellCommandProcessor', () => {
|
|||||||
expect.stringContaining('Executing shell command in /current/dir:'),
|
expect.stringContaining('Executing shell command in /current/dir:'),
|
||||||
);
|
);
|
||||||
expect(mockExecuteCommand).toHaveBeenCalledWith(
|
expect(mockExecuteCommand).toHaveBeenCalledWith(
|
||||||
'{ !ls -l; }; pwd >/tmp/shell_pwd_randomBytes.tmp',
|
'{ !ls -l; }; __code=$?; pwd >/tmp/shell_pwd_randomBytes.tmp; exit $__code',
|
||||||
{ cwd: '/current/dir' },
|
{ cwd: '/current/dir' },
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
@@ -272,7 +272,7 @@ describe('useShellCommandProcessor', () => {
|
|||||||
expect.any(Number),
|
expect.any(Number),
|
||||||
);
|
);
|
||||||
expect(mockExecuteCommand).toHaveBeenCalledWith(
|
expect(mockExecuteCommand).toHaveBeenCalledWith(
|
||||||
'{ !sleep 5 & }; pwd >/tmp/shell_pwd_randomBytes.tmp',
|
'{ !sleep 5 & }; __code=$?; pwd >/tmp/shell_pwd_randomBytes.tmp; exit $__code',
|
||||||
{ cwd: '/current/dir' },
|
{ cwd: '/current/dir' },
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const useShellCommandProcessor = (
|
|||||||
const pwdFilePath = path.join(os.tmpdir(), pwdFileName);
|
const pwdFilePath = path.join(os.tmpdir(), pwdFileName);
|
||||||
if (!commandToExecute.endsWith('&')) commandToExecute += ';';
|
if (!commandToExecute.endsWith('&')) commandToExecute += ';';
|
||||||
// note here we could also restore a previous pwd with `cd {cwd}; { ... }`
|
// note here we could also restore a previous pwd with `cd {cwd}; { ... }`
|
||||||
commandToExecute = `{ ${commandToExecute} }; pwd >${pwdFilePath}`;
|
commandToExecute = `{ ${commandToExecute} }; __code=$?; pwd >${pwdFilePath}; exit $__code`;
|
||||||
|
|
||||||
const userMessageTimestamp = Date.now();
|
const userMessageTimestamp = Date.now();
|
||||||
addItemToHistory(
|
addItemToHistory(
|
||||||
|
|||||||
Reference in New Issue
Block a user