"The D Way" to run a sequence of executables?
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Fri Aug 24 22:48:39 UTC 2018
On Friday, August 24, 2018 11:36:25 AM MDT Matthew OConnor via Digitalmars-
d-learn wrote:
> I'd like to run a sequence of executables with something like
> std.process.execute, but I would like the sequence to error out
> if one of the executables returns a non-zero return code. What is
> the recommended way to do this? A wrapper that throws exceptions?
> Checking return values?
AFAIK, you're only two options are to either make consequitive calls to one
of the execute family of functions where you check the return code and act
accordingly (whether you use exceptions to deal with it is up to you, but
either way, you have to check the result of each call to execute, since it
doesn't throw), or you use one of the functions which uses the shell (e.g.
executeShell) and write it out the way you would on the command-line with
||'s and/or &&'s.
Either way, Phobos doesn't provide any functions that are specifically for
calling a sequence of executables rather than just one. So, you're going to
have to figure out how to put that together in a way that works best for you
and what you're doing given what std.process has.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list