Re: exec() gives output??
From: Jürgen Exner (jurgenex_at_hotmail.com)
Date: 10/25/03
- Next message: James Willmore: "Re: how to do something"
- Previous message: Lex: "how to do something"
- In reply to: Experienced but Undocumented: "exec() gives output??"
- Next in thread: Experienced but Undocumented: "Re: exec() gives output??"
- Reply: Experienced but Undocumented: "Re: exec() gives output??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 25 Oct 2003 17:49:30 GMT
Experienced but Undocumented wrote:
> I'd like to execute a command on the server
What server? WAIS? NTFS? HTTP? FTP?
> from a PERL script. This
> particular command takes a long time to execute, so I would not like
> the PERL script to wait for a response. I was under the impression
> that exec() would do the trick, but it doesn't...
Well, it can't.
A successful call to exec() replaces the Perl script with whatever exec() is
calling. So there is nothing left that could possibly wait for a response
from exec().
> it seems to work the
> same as system().
That's not correct. As the manual clearly states:
system LIST
system PROGRAM LIST
Does exactly the same thing as "exec LIST", except that a fork
is done first, and the parent process waits for the child
process to complete. [...]
Did you even bother to read even the first sentence of the documentation for
the functions you are using?
> Any suggestions?
Either start the external program from system() in the background (how to do
that depends on your OS and may not be possible on all OSes) or use fork().
Details please see the man page for fork.
jue
- Next message: James Willmore: "Re: how to do something"
- Previous message: Lex: "how to do something"
- In reply to: Experienced but Undocumented: "exec() gives output??"
- Next in thread: Experienced but Undocumented: "Re: exec() gives output??"
- Reply: Experienced but Undocumented: "Re: exec() gives output??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|