Closed ormaaj closed 1 month ago
That's a good point. I'll see if it can be done without too much pain.
Can you please try the latest git of execline and tell me if it's working for you? ?
will be set if you deviate from the default -i
, meaning there's a case where backtick's child crashes or exits nonzero, but backtick still execs. (By default, it only execs if the child succeeded, so setting ?
makes no sense.)
Now it does
it works! And now I use it lots.
Command substitutions in standard shells always set the special parameter
?
as a side-effect, so it is generally possible to retrieve the exit status of a command while capturing output. AFAICT thebacktick
utility is just opaque and discards the status unconditionally.The only practical workaround I know of currently is to replace
backtick v { ... }
with an equivalentpipeline { ... } withstdinas v wait -o { }
.backtick
is certainly much more concise and reasonable for simple tasks so it would be very convenient if the status returned by its wait() were exposed through?
.