Skip to content

Commit c8c6241

Browse files
committed
Add pipefail module
1 parent 66c9995 commit c8c6241

File tree

1 file changed

+16
-0
lines changed
  • stdlib-candidate/std-rfc/pipefail

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export alias default-run-external = run-external
2+
3+
export def --wrapped run-external [...rest: string] {
4+
let results = default-run-external ($rest | first) ...($rest | skip 1) | complete
5+
if $results.exit_code != 0 {
6+
error make {
7+
msg: "External command failed"
8+
label: {
9+
text: "command had a non-zero exit code",
10+
span: (metadata $rest).span
11+
}
12+
}
13+
} else {
14+
$results.stdout
15+
}
16+
}

0 commit comments

Comments
 (0)