LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   32512 error code in Perl when trying to run shell command (https://www.linuxquestions.org/questions/programming-9/32512-error-code-in-perl-when-trying-to-run-shell-command-847192/)

basher400 11-29-2010 07:10 AM

32512 error code in Perl when trying to run shell command
 
hi

when I execute the command from the shell command line - it works and no error code.
if I do the exact same command from a perl file - it fails with code 32512.
the file is created from the same perl script that runs the command that fails. file permission is 0664.

Code:

#! /usr/local/pkg/perl-5.8.8/bin/perl

print "Content-type: text/html\n\n";

my $commandStr="babel -icif '/mypath/butadiene.cif' -opdb '/mypath/butadiene.cif'";

my $cmdResults=`$commandStr` or print "error code: $?, error string: $!";

result:
Quote:

error code: 32512, error string:
what could error code 32512 mean in this case? why is it working from the command line and not from the perl script?

TB0ne 11-29-2010 09:11 AM

Could be because the "babel" command isn't in your path when you run the script. Did you try to specify the entire fully-qualified path to babel? And did you notice that both your input and output files are the same??

wje_lq 11-29-2010 10:18 AM

Quote:

Originally Posted by TB0ne (Post 4174648)
Could be because the "babel" command isn't in your path when you run the script.

In the name of the Flying Spaghetti Monster,

I just tried that with a nonexistent "babel", and got -1, not 32512. 32512 in hex is 7F00. According to the man page for waitpid(), this indicates a return code of 127 from the program. You should find out why babel is returning with an exit code of 127.


All times are GMT -5. The time now is 10:19 PM.