Skip to content

Error in complete exit_code field instead of numerical exit code #12369

@132ikl

Description

@132ikl

Describe the bug

When running with an external command which exits with, eg., a SIGABRT, complete contains an internal error:

$ ./a.out | complete
SIGABRT: child process './a.out' core dumped
╭───────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ stdout    │                                                                                                                    │
│ stderr    │                                                                                                                    │
│ exit_code │ ExternalCommand { label: "core dumped", help: "SIGABRT: child process './a.out' core dumped", span: Span { start:  │
│           │ 141774, end: 141781 } }                                                                                            │
╰───────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

How to reproduce

  1. Run a program which throws a SIGABRT (may happen for other errors as well?)
#include <signal.h>

int main() {
    raise(SIGABRT);
}
  1. Run the executable and pipeline into complete, eg. ./a.out | complete

Expected behavior

To provide a numerical exit code

Screenshots

No response

Configuration

key value
version 0.92.0
branch makepkg
commit_hash c3428b8
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.75.0 (82e1608df 2023-12-21)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.75.0 (1d8b05cdd 2023-11-20)
build_time 2024-04-02 18:50:27 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, trash, which
installed_plugins clipboard

Additional context

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:signal-cancelProblems with how executions react to signals or attempts at cancellation (CTRL-C)category:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions