4 ms·
What happens if the next program in the pipe is not jb? Does jb also exit with a code? For example `jb | jq`, where jq or a similar program discards the cancel
by throwawaynorway 2y ago
What happens if the next program in the pipe is not jb? Does jb also exit with a code?
For example `jb | jq`, where jq or a similar program discards the cancel character.
(Away from pc, unable to check right now.)
- h4l 2y agoGood question! Yep, jb exits with non-zero: $ jb size:number=oops; echo $? json.encode_number(): not all inputs are numbers: 'oops' json(): Could not encode the value of argument 'size:number=oops' as a 'number' value. Read from inline value. ␘ 1 If you pipe the jb error into jq, jq fails to parse the JSON (because of the Cancel ctrl char) and also errors: $ jb size:number=oops | jq json.encode_number(): not all inputs are numbers: 'oops' json(): Could not encode the value of argument 'size:number=oops' as a 'number' value. Read from inline value. parse error: Invalid numeric literal at line 2, column 0 $ declare -p PIPESTATUS declare -a PIPESTATUS=([0]="1" [1]="4") So jq exits with status 4 here.