toolbox icon indicating copy to clipboard operation
toolbox copied to clipboard

`toolbox run` does not return status of the command

Open van-de-bugger opened this issue 5 years ago • 3 comments

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.

van-de-bugger avatar Jan 05 '21 13:01 van-de-bugger

You'd think, y'know, a tool specifically intended for automation and perhaps CI/CD would have this basic feature of telling the user "oh, this step in the build failed" — a feature that has existed since PC-DOS.

You'd be wrong. :face_exhaling:

Rudd-O avatar Mar 07 '22 14:03 Rudd-O

@Rudd-O, please refrain from posting unconstructive criticism. I understand you frustration as a lot of software I personally use lacks some capabilities. There is a PR that solves the issue that I'd like to merge soon (#1013).

martymichal avatar Mar 07 '22 16:03 martymichal

#1013 is merged so it seems to me like this issue can be closed now.

notfirefox avatar Feb 19 '24 07:02 notfirefox