Panu Matilainen 49f118
From c96c622483589256fd4a6925a68eb7a7d67867e5 Mon Sep 17 00:00:00 2001
Panu Matilainen 49f118
Message-Id: <c96c622483589256fd4a6925a68eb7a7d67867e5.1560419355.git.pmatilai@redhat.com>
Panu Matilainen 49f118
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 49f118
Date: Thu, 13 Jun 2019 12:41:02 +0300
Panu Matilainen 49f118
Subject: [PATCH] Don't fail build trying to kill a non-existent process
Panu Matilainen 49f118
 (RhBug:1720143)
Panu Matilainen 49f118
Panu Matilainen 49f118
The job killer introduced at 06953879d3e0b1e9a434979056d1225ab4646142
Panu Matilainen 49f118
failed to take into account the fact that the processes *can* die between
Panu Matilainen 49f118
us grabbing the pids and actually killing them, and that trying to kill
Panu Matilainen 49f118
a non-existent process will cause a script running with -e to actually
Panu Matilainen 49f118
terminate an error. So we end up failing a successful build by trying
Panu Matilainen 49f118
to kill process that exited on its own, ugh :)
Panu Matilainen 49f118
---
Panu Matilainen 49f118
 macros.in | 2 +-
Panu Matilainen 49f118
 1 file changed, 1 insertion(+), 1 deletion(-)
Panu Matilainen 49f118
Panu Matilainen 49f118
diff --git a/macros.in b/macros.in
Panu Matilainen 49f118
index 724e53a19..50fe044c1 100644
Panu Matilainen 49f118
--- a/macros.in
Panu Matilainen 49f118
+++ b/macros.in
Panu Matilainen 49f118
@@ -816,7 +816,7 @@ package or when debugging this package.\
Panu Matilainen 49f118
 #%___build_body		%{nil}
Panu Matilainen 49f118
 %___build_post	\
Panu Matilainen 49f118
   RPM_EC=$?\
Panu Matilainen 49f118
-  for pid in $(jobs -p); do kill -9 ${pid}; done\
Panu Matilainen 49f118
+  for pid in $(jobs -p); do kill -9 ${pid} || continue; done\
Panu Matilainen 49f118
   exit ${RPM_EC}\
Panu Matilainen 49f118
 %{nil}
Panu Matilainen 49f118
 
Panu Matilainen 49f118
-- 
Panu Matilainen 49f118
2.21.0
Panu Matilainen 49f118