aboutsummaryrefslogtreecommitdiff
path: root/core/carbs-init/patches/respawn-fix.patch
blob: 12761e89b85043c2a590bc1f41f4acef135730a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From cab27917dc954294e92c3979570841b85f67619d Mon Sep 17 00:00:00 2001
From: Cem Keylan <cem@ckyln.com>
Date: Thu, 17 Sep 2020 00:14:49 +0300
Subject: [PATCH] respawn: handle errors

---
 contrib/respawn | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/respawn b/contrib/respawn
index 1b914ea..4126cdb 100644
--- a/contrib/respawn
+++ b/contrib/respawn
@@ -18,6 +18,10 @@ case "$1" in
 esac
 
 while :; do
-    "$@"
+    "$@" || err=$?
+    case $err in
+        # Usually Ctrl+C interrupt.
+        12[7-9]|130) exit 0
+    esac
     [ "$delay" ] && sleep "$delay"
 done
-- 
2.28.0