teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
From c96c622483589256fd4a6925a68eb7a7d67867e5 Mon Sep 17 00:00:00 2001
Message-Id: <c96c622483589256fd4a6925a68eb7a7d67867e5.1560419355.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 13 Jun 2019 12:41:02 +0300
Subject: [PATCH] Don't fail build trying to kill a non-existent process
 (RhBug:1720143)

The job killer introduced at 06953879d3e0b1e9a434979056d1225ab4646142
failed to take into account the fact that the processes *can* die between
us grabbing the pids and actually killing them, and that trying to kill
a non-existent process will cause a script running with -e to actually
terminate an error. So we end up failing a successful build by trying
to kill process that exited on its own, ugh :)
---
 macros.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/macros.in b/macros.in
index 724e53a19..50fe044c1 100644
--- a/macros.in
+++ b/macros.in
@@ -816,7 +816,7 @@ package or when debugging this package.\
 #%___build_body		%{nil}
 %___build_post	\
   RPM_EC=$?\
-  for pid in $(jobs -p); do kill -9 ${pid}; done\
+  for pid in $(jobs -p); do kill -9 ${pid} || continue; done\
   exit ${RPM_EC}\
 %{nil}
 
-- 
2.21.0