"oc debug" should exit non-zero when the executed command returns non-zero
@juanvallejo is already working on this.
Since Feb 2, 2018.
- Dominant language
- Go
- Stars
- 8.7k
- Forks
- 4.8k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 53
Description
The oc debug command seems to always exit with a shell status code of 0 even when the executed command exits non-zero. This is counter intuitive and makes using oc debug in a set -e shell script difficult.
There should a new flag to tell oc debug to exit non-zero when the executed command exits non-zero, or even better, to make oc debug exit the same exit code as the executed command.
Version
[root@xxx-master ~]# oc version
oc v1.5.1
kubernetes v1.5.2+43a9be4
features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://openshift.example.com:8443
openshift v1.5.1
kubernetes v1.5.2+43a9be4
Steps To Reproduce
oc run busybox --image=busybox:ubuntu --replicas=0 # creates a sample DC with no replicas
oc debug dc/busybox -- /bin/true # run a successful command
echo $? # => 0 (as expected)
oc debug dc/busybox -- /bin/false # run an unsuccessful command
echo $? # => 0 (expected: 1)
oc debug dc/busybox -- /bin/non-existent # run a non-existent command
echo $? # => 0 (expected: 127)
Current Result
All 3 oc debug commands above exit with status 0.
Expected Result
The above oc debug commands should set the same exit status as if they were run through /bin/bash -ce instead of oc debug:
- the first
oc debugcommand should exit with status 0; - the second
oc debugcommand should exit with status 1; - the third
oc debugcommand should exit with status 127.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.