don't be noisy on stderr when Ctrl-C is hit
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
diff --git a/got/got.c b/got/got.c
index b0622d7..6b95775 100644
--- a/got/got.c
+++ b/got/got.c
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
got_commands[i].cmd_usage();
error = got_commands[i].cmd_main(argc, argv);
- if (error) {
+ if (error && !(sigint_received || sigpipe_received)) {
fprintf(stderr, "%s: %s\n", getprogname(), error->msg);
return 1;
}
diff --git a/libexec/got-read-blob/got-read-blob.c b/libexec/got-read-blob/got-read-blob.c
index d33d70d..d45817f 100644
--- a/libexec/got-read-blob/got-read-blob.c
+++ b/libexec/got-read-blob/got-read-blob.c
@@ -158,9 +158,10 @@ done:
imsg_clear(&ibuf);
if (err) {
- fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
- if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE)
+ if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) {
+ fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
got_privsep_send_error(&ibuf, err);
+ }
}
close(GOT_IMSG_FD_CHILD);
return err ? 1 : 0;
diff --git a/libexec/got-read-commit/got-read-commit.c b/libexec/got-read-commit/got-read-commit.c
index 56aac6a..9ebca90 100644
--- a/libexec/got-read-commit/got-read-commit.c
+++ b/libexec/got-read-commit/got-read-commit.c
@@ -174,9 +174,10 @@ done:
imsg_clear(&ibuf);
if (err) {
- fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
- if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE)
+ if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) {
+ fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
got_privsep_send_error(&ibuf, err);
+ }
}
close(GOT_IMSG_FD_CHILD);
return err ? 1 : 0;
diff --git a/libexec/got-read-object/got-read-object.c b/libexec/got-read-object/got-read-object.c
index 8f4ccd3..2d71593 100644
--- a/libexec/got-read-object/got-read-object.c
+++ b/libexec/got-read-object/got-read-object.c
@@ -219,9 +219,10 @@ done:
imsg_clear(&ibuf);
if (err) {
- fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
- if(!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE)
+ if(!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) {
+ fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
got_privsep_send_error(&ibuf, err);
+ }
}
close(GOT_IMSG_FD_CHILD);
return err ? 1 : 0;
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index debf114..24f359a 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -507,9 +507,10 @@ main(int argc, char *argv[])
got_object_cache_close(&objcache);
imsg_clear(&ibuf);
if (err) {
- fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
- if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE)
+ if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) {
+ fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
got_privsep_send_error(&ibuf, err);
+ }
}
close(GOT_IMSG_FD_CHILD);
return err ? 1 : 0;
diff --git a/libexec/got-read-tree/got-read-tree.c b/libexec/got-read-tree/got-read-tree.c
index 176d429..9030954 100644
--- a/libexec/got-read-tree/got-read-tree.c
+++ b/libexec/got-read-tree/got-read-tree.c
@@ -172,9 +172,10 @@ done:
imsg_clear(&ibuf);
if (err) {
- fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
- if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE)
+ if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) {
+ fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
got_privsep_send_error(&ibuf, err);
+ }
}
close(GOT_IMSG_FD_CHILD);
return err ? 1 : 0;