System Return Value?

G

g4173c

Hi:

I've been reading perldoc -f system and have been trying:

system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
${design}.ctl Failed!, Please check verix.log\n";

To get the return value.

I see the program doing:

**> exit 1

However it doesn't execute the die command. I've also tried this in and
If statement and other things, but without any luck. Any ideas what
else I could try?

Thanks is advanced for any help here!

Tom
 
P

Paul Lalli

I've been reading perldoc -f system and have been trying:

system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
${design}.ctl Failed!, Please check verix.log\n";

To get the return value.

I see the program doing:

**> exit 1

What does it mean that the program is "doing" that? Is that output
that the verix program generates? Or is that a line of code in verix
that you think it should be executing?
However it doesn't execute the die command.

Then system() is pretty clearly returning 0.
I've also tried this in and
If statement and other things, but without any luck. Any ideas what
else I could try?

I don't really understand what your question is, or what problem you're
trying to solve. My *guess* is that you are under the belief that the
verix program is exiting with a status of 1, and that the Perl program
is therefore wrong because it's not executing the die() statement. Is
that correct? If so, I respectfully disagree.

If the die() statement is not executing, then system() returned 0.
Period. No other way around it. Your assumption about what verix
exited with, therefore, is wrong. Why not simply run the verix command
in a shell, and echo out the value of $? to see what it actually is?

You can also try capturing the value of system, and/or print the value
of $? from within the Perl script:

my $retval = system ("verix -i ${design}.ctl");
if ($retval != 0) {
die "ERROR: verix -i ${design}.ctl Failed: $retval ($?)\n";
} else {
warn "I think something's wrong - system() returned 0 ($?)\n";
}

Paul Lalli
 
G

g4173c

You can also try capturing the value of system, and/or print the value
of $? from within the Perl script:

Good idea, tried that and got:

**> exit 1
0

This is what Verix program does after it finds an error, however
doesn't
seem to set the return value correctly.

Thanks for the help!
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top