System Return Value?

Discussion in 'Perl Misc' started by g4173c@motorola.com, Jan 11, 2007.

  1. Guest

    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
     
    , Jan 11, 2007
    #1
    1. Advertising

  2. Paul Lalli Guest

    wrote:
    > 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
     
    Paul Lalli, Jan 11, 2007
    #2
    1. Advertising

  3. Guest


    > 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
     
    , Jan 11, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PvdK
    Replies:
    0
    Views:
    2,981
  2. Sara Shoemaker

    Return value from system() on Linux

    Sara Shoemaker, Jan 21, 2004, in forum: C Programming
    Replies:
    2
    Views:
    572
    Allin Cottrell
    Jan 21, 2004
  3. Seong-Kook Shin
    Replies:
    1
    Views:
    493
    Richard Bos
    Jun 18, 2004
  4. Greenhorn
    Replies:
    15
    Views:
    827
    Keith Thompson
    Mar 6, 2005
  5. Sergeant_Pepper

    Return-Code of "system" on a 64-bit system

    Sergeant_Pepper, Dec 18, 2005, in forum: Perl Misc
    Replies:
    2
    Views:
    98
    Sergeant_Pepper
    Dec 19, 2005
Loading...

Share This Page