-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Show error message when processes are killed by SIGSEGV/SIGILL/etc #12874
Copy link
Copy link
Labels
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)A:external-commandsIssues related to external commandsIssues related to external commandscategory:enhancementNew feature or requestNew feature or request
Milestone
Description
Related problem
Nushell currently does not print anything when a program is terminated by a signal:
> echo "int main() { asm("ud2"); }" out> sigill.c
> gcc sigill.c -o sigill.out
> ./sigill.out
> # *crickets*
> echo "int main() { int v = *((int *)0x0); }" out> sigsegv.c
> gcc sigsegv.c -o sigsegv.out
> ./sigsegv.out
> # *crickets*
This could be okay if you have the exit code displayed as part of the prompt, but if you don't then it looks like everything completed successfully.
By contrast, Bash tells you what went wrong:
$ ./sigill.out
Illegal instruction
$ ./sigsegv.out
Segmentation fault
Describe the solution you'd like
If a signal is the reason a program exits prematurely, print the associated comment so the user is aware of the problem (available at https://man7.org/linux/man-pages/man7/signal.7.html "Standard signals" table), or the same for the Windows equivalent. This can be retrieved on nix with ExitStatusExt::signal.
Describe alternatives you've considered
No response
Additional context and details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)A:external-commandsIssues related to external commandsIssues related to external commandscategory:enhancementNew feature or requestNew feature or request