mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-22 17:26:58 -07:00
fix(hooks): treat all non-zero exit codes except 1 as blocking
This commit is contained in:
@@ -102,7 +102,7 @@ describe('Hooks System Integration', () => {
|
||||
'stderr_block_hook.cjs',
|
||||
`
|
||||
process.stderr.write('File writing blocked by security policy');
|
||||
process.exit(101);
|
||||
process.exit(2);
|
||||
`,
|
||||
);
|
||||
|
||||
|
||||
@@ -460,18 +460,18 @@ export class HookRunner {
|
||||
decision: 'allow',
|
||||
systemMessage: text,
|
||||
};
|
||||
} else if (exitCode === EXIT_CODE_BLOCKING_ERROR) {
|
||||
// Blocking error
|
||||
return {
|
||||
decision: 'deny',
|
||||
reason: text,
|
||||
};
|
||||
} else {
|
||||
// Non-blocking error (EXIT_CODE_NON_BLOCKING_ERROR or any other code)
|
||||
} else if (exitCode === EXIT_CODE_NON_BLOCKING_ERROR) {
|
||||
// Non-blocking error (EXIT_CODE_NON_BLOCKING_ERROR = 1)
|
||||
return {
|
||||
decision: 'allow',
|
||||
systemMessage: `Warning: ${text}`,
|
||||
};
|
||||
} else {
|
||||
// All other non-zero exit codes (including 2) are blocking
|
||||
return {
|
||||
decision: 'deny',
|
||||
reason: text,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user