mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-01-17 14:29:13 +00:00
Compare commits
4 Commits
chore-acti
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8cb10656f | ||
|
|
a7abd8d09f | ||
|
|
c9af74816a | ||
|
|
9cfea73207 |
@@ -54,6 +54,7 @@ describe('JSON output', () => {
|
||||
});
|
||||
|
||||
it('should return a JSON error for enforced auth mismatch before running', async () => {
|
||||
const originalOpenaiApiKey = process.env['OPENAI_API_KEY'];
|
||||
process.env['OPENAI_API_KEY'] = 'test-key';
|
||||
await rig.setup('json-output-auth-mismatch', {
|
||||
settings: {
|
||||
@@ -68,7 +69,7 @@ describe('JSON output', () => {
|
||||
} catch (e) {
|
||||
thrown = e as Error;
|
||||
} finally {
|
||||
delete process.env['OPENAI_API_KEY'];
|
||||
process.env['OPENAI_API_KEY'] = originalOpenaiApiKey;
|
||||
}
|
||||
|
||||
expect(thrown).toBeDefined();
|
||||
|
||||
@@ -848,7 +848,7 @@ export async function start_sandbox(
|
||||
sandboxProcess?.on('close', (code, signal) => {
|
||||
process.stdin.resume();
|
||||
if (code !== 0 && code !== null) {
|
||||
console.log(
|
||||
console.error(
|
||||
`Sandbox process exited with code: ${code}, signal: ${signal}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -517,24 +517,39 @@ export function resolveCommandPath(command: string): {
|
||||
try {
|
||||
const isWin = process.platform === 'win32';
|
||||
|
||||
const checkCommand = isWin ? 'where' : 'command';
|
||||
const checkArgs = isWin ? [command] : ['-v', command];
|
||||
if (isWin) {
|
||||
const checkCommand = 'where.exe';
|
||||
const checkArgs = [command];
|
||||
|
||||
let result: string | null = null;
|
||||
try {
|
||||
result = execFileSync(checkCommand, checkArgs, {
|
||||
encoding: 'utf8',
|
||||
shell: isWin,
|
||||
}).trim();
|
||||
} catch {
|
||||
console.warn(`Command ${checkCommand} not found`);
|
||||
}
|
||||
let result: string | null = null;
|
||||
try {
|
||||
result = execFileSync(checkCommand, checkArgs, {
|
||||
encoding: 'utf8',
|
||||
shell: false,
|
||||
}).trim();
|
||||
} catch {
|
||||
return { path: null, error: undefined };
|
||||
}
|
||||
|
||||
if (!result) return { path: null, error: undefined };
|
||||
if (!isWin) {
|
||||
return result ? { path: result } : { path: null };
|
||||
} else {
|
||||
const shell = '/bin/sh';
|
||||
const checkArgs = ['-c', `command -v ${escapeShellArg(command, 'bash')}`];
|
||||
|
||||
let result: string | null = null;
|
||||
try {
|
||||
result = execFileSync(shell, checkArgs, {
|
||||
encoding: 'utf8',
|
||||
shell: false,
|
||||
}).trim();
|
||||
} catch {
|
||||
return { path: null, error: undefined };
|
||||
}
|
||||
|
||||
if (!result) return { path: null, error: undefined };
|
||||
accessSync(result, fsConstants.X_OK);
|
||||
return { path: result, error: undefined };
|
||||
}
|
||||
return { path: result, error: undefined };
|
||||
} catch (error) {
|
||||
return {
|
||||
path: null,
|
||||
|
||||
Reference in New Issue
Block a user