diff options
Diffstat (limited to 'appl/cmd/sh/sh.b')
| -rw-r--r-- | appl/cmd/sh/sh.b | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/appl/cmd/sh/sh.b b/appl/cmd/sh/sh.b index 05a8227a..7cd69cb0 100644 --- a/appl/cmd/sh/sh.b +++ b/appl/cmd/sh/sh.b @@ -221,7 +221,7 @@ system(drawctxt: ref Draw->Context, cmd: string): string return Context.new(drawctxt).run(ref Listnode(n, nil) :: nil, 0); } exception e { "fail:*" => - return e[5:]; + return failurestatus(e); } } @@ -232,7 +232,7 @@ run(drawctxt: ref Draw->Context, argv: list of string): string return Context.new(drawctxt).run(stringlist2list(argv), 0); } exception e { "fail:*" => - return e[5:]; + return failurestatus(e); } } @@ -294,7 +294,7 @@ runfile(ctxt: ref Context, fd: ref Sys->FD, path: string, args: list of ref List laststatus = walk(ctxt, n, 0); } exception e2 { "fail:*" => - laststatus = e2[5:]; + laststatus = failurestatus(e2); } } else laststatus = walk(ctxt, n, 0); @@ -792,7 +792,7 @@ runexternal(ctxt: ref Context, args: list of ref Listnode, last: int): string EPIPE => return EPIPE; "fail:*" => - return e[5:]; + return failurestatus(e); } } extstart := chan of int; @@ -819,6 +819,16 @@ runexternal(ctxt: ref Context, args: list of ref Listnode, last: int): string return err; } +failurestatus(e: string): string +{ + s := e[5:]; + while(s != nil && (s[0] == ' ' || s[0] == '\t')) + s = s[1:]; + if(s != nil) + return s; + return "failed"; +} + runhashpling(ctxt: ref Context, fd: ref Sys->FD, path: string, argv: list of ref Listnode, last: int): string { @@ -1020,7 +1030,7 @@ waitfor(ctxt: ref Context, pids: list of int): string (who, line, s) := parsewaitstatus(ctxt, string buf[0:n]); if (s != nil) { if (len s >= 5 && s[0:5] == "fail:") - s = s[5:]; + s = failurestatus(s); else diagnostic(ctxt, line); } @@ -1911,7 +1921,7 @@ builtin_run(ctxt: ref Context, args: list of ref Listnode, nil: int): string } exception e { "fail:*" => ctxt.pop(); - return e[5:]; + return failurestatus(e); } } |
