Skip to content

fix: reject signal-terminated drop-sudo commands - #155

Open
original4422 wants to merge 1 commit into
openai:mainfrom
original4422:fix/issue-152-signal-exit
Open

fix: reject signal-terminated drop-sudo commands#155
original4422 wants to merge 1 commit into
openai:mainfrom
original4422:fix/issue-152-signal-exit

Conversation

@original4422

Copy link
Copy Markdown

Summary

Treat child processes terminated by a signal as failed drop-sudo commands instead of normalizing their null exit code to zero.

Fixes #152.

Root cause

Node reports code === null and supplies the terminating signal separately for a signal-terminated child. The shared execCommand() helper used code ?? 0, so required privilege-transition commands could resolve successfully after interruption.

Changes

  • preserve the nullable child exit code;
  • reject required commands when code is null and include the signal in the diagnostic;
  • retain the exit code and signal on the structured error;
  • add a mocked regression for close(null, "SIGTERM");
  • rebuild the checked-in dist/main.js bundle.

Validation

  • Regression test failed on unmodified main with Missing expected rejection.
  • node --test test/linuxCredentials.test.mjs — 5 passed.
  • pnpm run check — passed.
  • pnpm test — 145 tests: 142 passed, 3 platform-dependent tests skipped on macOS.
  • git diff --check — passed.

Risk

Low. Numeric exit handling is unchanged. Signal termination is now a failure for required commands and remains non-throwing only at call sites that explicitly set ignoreFailure.

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@original4422

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drop-sudo treats signal-terminated helper commands as successful

1 participant