Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-06 Thread Saj Goonatilleke via skaware
On 6 Sep 2022, at 10:35, cat æscling via skaware wrote: > using if instead of foreground sounds like what is wanted here Indeed, thanks. That makes sense now that you mention it. (I'm not entirely sure why my brain failed to make the connection. Maybe because of preconceived notions of 'if'

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Laurent Bercot
As other people said, using "if" instead of "foreground" is the idiomatic way to exit on child error. I myself am a staunch "#!/bin/sh -e" user, and almost never use "foreground" in execline scripts - only when I specifically need the exit code of some command. Forwarding signals to a child

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread cat æscling via skaware
The point is correct; using if instead of foreground sounds like what is wanted here (Though in this case the rest of the script wouldn’t run in the data directory; besides,`execline-cd data [etc]` would just error out immediately.)

Re: Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Brett Neumeier
Perhaps just wrap each preparation command in an if block? if { execline-cd data } Will continue the script if execline-cd succeeds, and abort if it does not. On Mon, Sep 5, 2022, 1:54 PM Saj Goonatilleke via skaware < skaware@list.skarnet.org> wrote: > Hello, > > Within the context of, say,

Succinct, idiomatic abort in execlineb scripts?

2022-09-05 Thread Saj Goonatilleke via skaware
Hello, Within the context of, say, an s6 run script that needs to do a little bit of prep work before execing into a server, it is often helpful to abort early if any of said prep work stumbles upon an unexpected problem. Maybe the filesystem is R/O. Or full. Maybe an operator has fat-fingered