Skip to content

Return a traditional exit code when core dumped - #12370

Closed
sholderbach wants to merge 2 commits into
nushell:mainfrom
sholderbach:fix-12369-dump-int-exit
Closed

sholderbach wants to merge 2 commits into
nushell:mainfrom
sholderbach:fix-12369-dump-int-exit

Conversation

@sholderbach

Copy link
Copy Markdown
Member

Description

Attempt to fix #12369

running a program fail dumping its core with fail | complete | get exit_code should return a Value::Int corresponding to its exit code.

User-Facing Changes

Previously we sent a full Value::Error(ShellError) which was
incompatible with all other exit code logic.

Now get just the exit code but still print to STDERR.

running a program `fail` dumping its core with `fail | complete | get
exit_code` should return a `Value::Int` corresponding to its exit code.

Previously we sent a full `Value::Error(ShellError)` which was
incompatible with all other exit code logic.

Now get just the exit code but still print to STDERR.
@sholderbach sholderbach added the notes:fixes Noted in "Bug fixes" section label Apr 2, 2024
span: head,
},
let _ = exit_code_tx.send(Value::int(
// If we don't get a code (unlikely)

@IanManske IanManske Apr 2, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is highly likely. On unix, if a process is killed via signal, then code() will be None.

It's probably out of scope for this PR, but in the future this should match what we do for signals when the process doesn't core dump (right now, we always return -1 which is odd).

@WindSoilder

Copy link
Copy Markdown
Contributor

I think it's already handled by #12774, maybe we can close this

@sholderbach

Copy link
Copy Markdown
Member Author

Yup, thanks for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in complete exit_code field instead of numerical exit code

3 participants