Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: calling an external program, from within a perl script

by nick (Sexton)
on Aug 09, 2001 at 21:38 UTC ( [id://103524]=note: print w/replies, xml ) Need Help??


in reply to Re: calling an external program, from within a perl script
in thread calling an external program, from within a perl script

Ok, this explains the error level. However, it doesn't 
explain the fact that the command doesn't work from this 
perl script. However, it does work from the cmnd 
line, and also from a little 3 liner (in the examples 
above).

So I know the system call is working, because it can call 
the 3 line perl script. I know the command 'mkfs' is 
working, because I can run the 3 liner, and the command 
executes.

when I run the 'mkfs' command from the large perl script,
 even though ($? >> 8) may return a 0 exit code, the device 
is not created, because there is not XFS filesystem on the
device when I check after running it.

Also, if I grab the output with backticks, there is none.
 (and this is a verbose command, so there should be several 
lines of output when generating the XFS Filesystem).

Any thoughts?

- Nick
  • Comment on Re: Re: calling an external program, from within a perl script

Replies are listed 'Best First'.
Re: Re: Re: calling an external program, from within a perl script
by trantor (Chaplain) on Aug 09, 2001 at 22:39 UTC

    Let's see...

    • SIGPIPE is sent to the process when it tries to write to a pipe with no connected readers
    • mkfs -t fstype is just a wrapper that spawns the appropriate mkfs.fstype
    • It works fine on the command line
    I tried the script myself using mkfs -t ext2 /dev/fd0 and it worked fine. Messages were output to STDERR but no problem whatsoever. I don't have xfs so I can't test it under your conditions, but perhaps you can test the script under mine and see what happens.

    If it works fine, my guess is that mkfs.xfs expects some kind of interaction with the user (you mentioned a condition where --force was necessary) and it dies because it's not connected to a terminal.

    If it still does not work, experiment:

    • Is the error code still the same?
    • What happens using another device?
    • What happens using an illegal device on purpose?
    • What happens using anothe filesystem type?
    • And with an illegal filesystem type?
    • What happens with another command?
    • Does a shell line like echo `your command` work?
    And so on. By observing (hopefully) different behaviours, it should be possible to determine what triggers the problem. Hope this helps!

    -- TMTOWTDI

      Maybe at this point it would be good to know that the main program is a CGI, therefore, the fact that I can write a simple perl script to run this command wil work when I run it from the command line, but wont when I run that same script from the CGI. (however, if I run a system call in the CGI for a command, like for instance, cat, ir works fine.
       
      Does this help at all?
       
      - Nick

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://103524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found