Re: How to continue process without waiting for the output of system()?



Cod <zencod@xxxxxxxxx> wrote:
For example , I wrote:

system("calc");
print "hello";

Without a newline in the print, you have to careful that buffering
isn't going to get you.


Before the calc program is closed, the print statement will not
excute.

Any way to change the behavior?
I have tried fork, and system("calc&"), all failed.

What do you mean by "failed"?


My OS is WinXP, and I use Active Perl 5.8.8.


H:\>perl -e "fork or do {system('calc'); exit}; $|=1; print 'hello' "

Does what I expect.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: Printf and redirection (dont read previous message: its wrong)
    ... Only if, of course, it has a newline at the end of the string ... to fflush) because the process terminates with a call to ... exit(), which will call fflush. ... (Or by changing the buffering of stdout back to line buffered, ...
    (comp.os.linux.development.apps)
  • Re: Reading key presses
    ... always put a newline at the end and use gets. ... It's also possible (depending on the Forth implementation) that you may ... that it can also be worthwhile seeing if you can turn off the buffering ... I'd already replied to Gerald Lester before reading this. ...
    (comp.lang.tcl)
  • Re: getchar() problem
    ... five (including e newline in bo counts). ... caused is bug? ... You need to be more careful with that stty command. ...
    (comp.lang.c)
  • Re: Reading key presses
    ... puts -nonewline $pipeId $data ... For Tcl getting info from Forth, I'd suggest for the Forth program to always put a newline at the end and use gets. ... that it can also be worthwhile seeing if you can turn off the buffering ...
    (comp.lang.tcl)
  • Atomic line-reading without buffering
    ... newline) from a file (either by descriptor or stream) atomically, ... without buffering additional contents of the file? ...
    (comp.lang.c)