Skip to content

Show error message when processes are killed by SIGSEGV/SIGILL/etc #12874

@tgross35

Description

@tgross35

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)A:external-commandsIssues related to external commandscategory:enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions