containers / containers/toolbox

`run` does not return exit code of command

Open
#1,071 4 comments 0 reactions 0 assignees View on GitHub
1. Bug
Dominant language
Go
Stars
3.5k
Forks
262
Avg merge
3d 1h
Merged PRs (30d)
1

Description

**Describe the bug**

Toolbox does not return the exit code of the command it runs.

**Steps how to reproduce the behaviour**

1. Create a toolbox.
2. Execute `toolbox run cp /usr/bin/cp /usr/bin/foo`
3. See error message.
4. Execute `echo $?`

**Expected behaviour**

The output of step 4 should be 1.

**Actual behaviour**

The output of step 4 is 0.

**Output of `toolbox --version` (v0.0.90+)**

`toolbox version 0.0.99.3`

**Toolbox package info (`rpm -q toolbox`)**

`toolbox-0.0.99.3-4.fc36.x86_64`

**Output of `podman version`**

```
Client: Podman Engine
Version: 4.1.1
API Version: 4.1.1
Go Version: go1.18.3
Built: Wed Jun 15 16:31:58 2022
OS/Arch: linux/amd64
```

**Podman package info (`rpm -q podman`)**

`podman-4.1.1-1.fc36.x86_64`

**Info about your OS**

Fedora Silverblue 36

**Additional context**

I noticed the issue in a bash script with `-e` enabled (`-e Exit immediately if a command exits with a non-zero status`). The script invoked `toolbox run`, which invoked an erroneous command. The script did not exit immediately.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `toolbox run cp /usr/bin/cp /usr/bin/foo` and inspect the Go command path that handles `toolbox run` and its process exit status. Done means a failed command causes `toolbox run` to return the same non-zero exit code, including the reported `cp` example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.