mirror of
https://github.com/moby/buildkit.git
synced 2026-06-24 08:47:57 +00:00
ignore if kill can't find pid that is already gone
we use this script inside a rootless-pod (https://github.com/moby/buildkit/blob/master/examples/kubernetes/pod.rootless.yaml) to perform our builds and call it via a CI/CD tool, which returns a non-zero exit code, as the trap cannot kill the process, as it is already gone, in case everything went fine so we need to catch the error code from kill, which tries to kill a process that doesn't exist anymore and the suggestion is to just add || true, because we don't care about the exit code of kill ``` #17 DONE 4.2s sh: can't kill pid 65: No such process command terminated with exit code 1 ``` Signed-off-by: Steve Lohr <schdief.law@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@ set -eu
|
||||
# * addr
|
||||
# * log
|
||||
tmp=$(mktemp -d /tmp/buildctl-daemonless.XXXXXX)
|
||||
trap "kill \$(cat $tmp/pid); wait \$(cat $tmp/pid) || true; rm -rf $tmp" EXIT
|
||||
trap "kill \$(cat $tmp/pid) || true; wait \$(cat $tmp/pid) || true; rm -rf $tmp" EXIT
|
||||
|
||||
startBuildkitd() {
|
||||
addr=
|
||||
|
||||
Reference in New Issue
Block a user