containers / containers/toolbox

`toolbox run` does not return status of the command

Open
#657 3 comments 2 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 run` does not return the status of the executed command, it always returns status 0 regardless of the actual status of the command. Thus, toolbox is a great tool for interactive work, but it is hardly usable *in scripts*. For example, if I run `make` in a container (e. g. `toolbox run make`), the caller script can't easily know if the build was successful or failed. To find out build status I have to implement various workarounds.

**Steps how to reproduce the behaviour**

toolbox create
toolbox run true; echo $?
toolbox run false; echo $?
toolbox run /bin/bash -c "exit 33"; echo $?

**Actual behaviour**

$ toolbox run true; echo $?
0
$ toolbox run false; echo $?
0
$ toolbox run /bin/bash -c "exit 33"; echo $?
0

Note: toolbox status is always 0, regardless of the status of the executed command.

**Expected behaviour**

$ toolbox run true; echo $?
0
$ toolbox run false; echo $?
1
$ toolbox run /bin/bash -c "exit 33"; echo $?
33

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

$ toolbox --version
toolbox version 0.0.97

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

$ rpm -q toolbox
toolbox-0.0.97-1.fc33.x86_64

**Output of `podman version`**

$ podman --version
podman version 2.2.1

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

$ rpm -q podman
podman-2.2.1-1.fc33.x86_64

**Info about your OS**

$ cat /etc/system-release
Fedora release 33 (Thirty Three)
$ uname -a
Linux antec 5.8.18-300.fc33.x86_64 #1 SMP Mon Nov 2 19:09:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

**Additional context**

`podman exec` does return the status of the executed command:

$ podman exec fedora-toolbox-33 true; echo $?
0
$ podman exec fedora-toolbox-33 false; echo $?
1
$ podman exec fedora-toolbox-33 /bin/bash -c "exit 33"; echo $?
33

`fedora-toolbox-33` is the container created by toolbox. So, both container and podman work perfectly, but toolbox does not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.