selftest: Abort early on SIGPIPE.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 28 Sep 2010 05:40:27 +0000 (07:40 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 28 Sep 2010 07:12:39 +0000 (09:12 +0200)
selftest/filter-subunit
selftest/selftest.pl

index 3ec74c46c7adbe8882d92353bc4dc327c6aba750..872d07fdb11e90d0ea9ce30072e3641a2bfb53c1 100755 (executable)
@@ -53,4 +53,5 @@ msg_ops = subunithelper.FilterOps(out, opts.prefix, expected_failures,
 try:
        sys.exit(subunithelper.parse_results(msg_ops, statistics, sys.stdin))
 except subunithelper.ImmediateFail:
+       sys.stdout.flush()
        sys.exit(1)
index 2680b6adcee6fc1577b9c870a5d77c3b98d4e8ac..33af5e29b71828b957f9cc07822845b59f9231be 100755 (executable)
@@ -166,6 +166,14 @@ my $prefix = "./st";
 my @includes = ();
 my @excludes = ();
 
+sub pipe_handler {
+       my $sig = shift @_;
+       print STDERR "Exiting early because of SIGPIPE.\n";
+       exit(1);
+}
+
+$SIG{PIPE} = \&pipe_handler;
+
 sub find_in_list($$)
 {
        my ($list, $fullname) = @_;