Summary
Several commands call process.exit(1) immediately after outro() / console.log. Node's process.exit() does not flush pending stdout writes, so when output is piped (e.g. commit-echo config --json | jq), the final lines can be truncated or lost entirely. These calls also skip cleanup. Note src/commands/suggest.ts:147 already uses the correct pattern (process.exitCode = 1; return;).
Location
src/commands/suggest.ts:339 (auto-commit without staged changes), :421 (commit failure)
src/commands/config.ts:185 (config --json with no config), :221, :227, :248 (config set error paths)
src/commands/completion.ts:701 (unsupported shell)
Code snippet
// src/commands/config.ts
console.log(JSON.stringify({ error: 'No configuration found...' }, null, 2));
process.exit(1); // ← can truncate the JSON above when stdout is a pipe
Suggested fix
Replace process.exit(1) with process.exitCode = 1; return; in these error paths (matching suggest.ts:147), so stdout flushes before the process exits.
Impact
- Scripted usage (
config --json, completion, suggest --commit) can receive truncated output with an error exit code, corrupting pipelines.
- Inconsistent with the established in-repo pattern for setting a failing exit code.
Summary
Several commands call
process.exit(1)immediately afteroutro()/console.log. Node'sprocess.exit()does not flush pending stdout writes, so when output is piped (e.g.commit-echo config --json | jq), the final lines can be truncated or lost entirely. These calls also skip cleanup. Notesrc/commands/suggest.ts:147already uses the correct pattern (process.exitCode = 1; return;).Location
src/commands/suggest.ts:339(auto-commit without staged changes),:421(commit failure)src/commands/config.ts:185(config --json with no config),:221,:227,:248(config set error paths)src/commands/completion.ts:701(unsupported shell)Code snippet
Suggested fix
Replace
process.exit(1)withprocess.exitCode = 1; return;in these error paths (matchingsuggest.ts:147), so stdout flushes before the process exits.Impact
config --json,completion,suggest --commit) can receive truncated output with an error exit code, corrupting pipelines.