in reply to looking for suggestion!!!
It seems your commands are broken, and you're spending effort trying to fix them at run-time. foo ; cd bar should be cd bar ; foo. You should fix your data before running your program, or at least separately from trying to execute them.
Why is a check.pl dying from SIGINT with no coredump considered successful? Why is a check.pl dying from SIGINT with coredump considered unsuccessful? While is running a program successfully considered an error? You're probably killing the program when you should be closing its input stream with Ctrl-D (default for unix) or Ctrl-Z (Windows).
You're printing $! when its meanlingless. You're not printing $? when its meanlingful.
You are using a C-style loop when a Perl-style counting loop would be simpler. In fact, you are using a C-style loop when a foreach loop would be ideal.
@run is both misnamed (it doesn't contain a run) and incorrectly pluralised (it s singular yet it contains multiple of what it contains).
Basically, that whole snippet should be:
for my $cmd (@cmds) { system($cmd) die("<$cmd>: Can't spawn: $!\n") if $? == -1; die("<$cmd> died from signal ", ($? & 0x7F), "\n") if $? & 0x7F; die("<$cmd> exited with code ", ($? >> 8), "\n") if $? >> 8; }
Everything extra is you trying to fix bugs made elsewhere, bugs better fixed elsewhere since fixing those bugs have nothing to do with executing commands.
|
|---|