Commit f8afbdc86ed6dde7d7bc0d2c51f6a89a358412c3

Stefan Sperling 2019-11-08T20:25:10

try harder not to hide errors from helper programs when got(1) exits

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/got/got.c b/got/got.c
index 9d1c786..a3a9541 100644
--- a/got/got.c
+++ b/got/got.c
@@ -219,7 +219,10 @@ main(int argc, char *argv[])
 			got_commands[i].cmd_usage();
 
 		error = got_commands[i].cmd_main(argc, argv);
-		if (error && !(sigint_received || sigpipe_received)) {
+		if (error && error->code != GOT_ERR_CANCELLED &&
+		    error->code != GOT_ERR_PRIVSEP_EXIT &&
+		    !(sigpipe_received &&
+		      error->code == GOT_ERR_ERRNO && errno == EPIPE)) {
 			fprintf(stderr, "%s: %s\n", getprogname(), error->msg);
 			return 1;
 		}