Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make finding location of errors easier

  - when verbose=1, print $text also on fail
  - TSH_ERREXIT to emulate 'set -e' in bash; also prints fail info like
    TSH_VERBOSE=1
  • Loading branch information...
commit 638a9cf0ebeb6e4b6c8bb5fe31734491944988c7 1 parent bcee4f4
@sitaramc authored
Showing with 6 additions and 2 deletions.
  1. +3 −2 Tsh.pm
  2. +3 −0  doc/tsh.mkd
View
5 Tsh.pm
@@ -461,13 +461,14 @@ sub fail {
say STDERR "# $msg2";
}
- dbg(1, "FAIL: $msg1", $testname || '', "test number $testnum", "L: $line");
+ local $TSH_VERBOSE = 1 if $ENV{TSH_ERREXIT};
+ dbg(1, "FAIL: $msg1", $testname || '', "test number $testnum", "L: $line", "results:\n$text");
# count the error and add the testname to the list if it is set
$err_count++;
push @errors_in, $testname if $testname;
- return unless $die;
+ return unless $die or $ENV{TSH_ERREXIT};
dbg(1, "exiting at cmd $cmd\n");
exit ( $rc || 74 );
View
3  doc/tsh.mkd
@@ -124,6 +124,9 @@ Also in both cases, the `TSH_VERBOSE` env var changes the output:
(Setting it to 4 produces too much output to be useful most of the time).
+`TSH_ERREXIT` (named after the long name of bash's '-e' option) forces an exit
+on the first error, which helps when developing scripts.
+
## tsh commands in detail
### macros
Please sign in to comment.
Something went wrong with that request. Please try again.