470,613 Members | 2,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

open pipe for system call does not work on windows

'Ello,

I'm writing a perl script to spawn child processes to execute jobs.
The jobs are system calls. I use open(SYSCALL, "cmd |), to make the
system calls because I need the pipe so I can log STDOUT to a file.
On Windows my script locks up after the first job is done. It works
fine on unix.

I am using fork to spawnt the child processes.

Any help is appreciated, or alternative suggestions is greatly
appreciated.

Thanks much.
Jul 19 '05 #1
4 10366
lu****@mediaone.net (Brian) wrote in message news:<96**************************@posting.google. com>...
'Ello,

I'm writing a perl script to spawn child processes to execute jobs.
The jobs are system calls. I use open(SYSCALL, "cmd |), to make the
system calls because I need the pipe so I can log STDOUT to a file.
On Windows my script locks up after the first job is done. It works
fine on unix.

I am using fork to spawnt the child processes.

Any help is appreciated, or alternative suggestions is greatly
appreciated.

Thanks much.


I use the following method and I get stdout back in a variable
NOTE quotes are back ticks (SHIFT Tilde )
$cmdString=`PRG_NAME PARMS`;

print $cmdString
Jul 19 '05 #2
Also, make sure you close when you're done. I've never really had any
issues, but from experience, I can tell you that if you fail to close()
you're eventually going to run into problems.

Also, make sure you're using a reasonabally modern (>= 5.6) perl on Windows.

w

Brian wrote:
'Ello,

I'm writing a perl script to spawn child processes to execute jobs.
The jobs are system calls. I use open(SYSCALL, "cmd |), to make the
system calls because I need the pipe so I can log STDOUT to a file.
On Windows my script locks up after the first job is done. It works
fine on unix.

I am using fork to spawnt the child processes.

Any help is appreciated, or alternative suggestions is greatly
appreciated.

Thanks much.

Jul 19 '05 #3
lu****@mediaone.net (Brian) wrote in message news:<96**************************@posting.google. com>...
'Ello,

I'm writing a perl script to spawn child processes to execute jobs.
The jobs are system calls. I use open(SYSCALL, "cmd |), to make the
system calls because I need the pipe so I can log STDOUT to a file.
No that is not necessary - you can re-open STDOUT to a file then just
use system().
On Windows my script locks up after the first job is done. It works
fine on unix.
ISTR this being a problem in 5.5 (or was it 5.4). Do you have really
anchient Perl? After all you seem to think this newsgroup still
exists and it hasn't existed for the same sort of time.
I am using fork to spawnt the child processes.


Oh, I thought you said you were using pipe-open.

fork() is not properly implemented by Windows. Avoid it.

Perhaps you should reduce your problem to a minimal but complete
script that illustrates the symptoms you are seeing and post it to a
newsgroup that still exists.
Jul 19 '05 #4
Thanks for all the comments.
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Laszlo Barabas | last post: by
10 posts views Thread by Marshall Dudley | last post: by
reply views Thread by olaf.dietsche | last post: by
3 posts views Thread by Karan | last post: by
2 posts views Thread by Steve R. Hastings | last post: by
10 posts views Thread by eSolTec, Inc. 501(c)(3) | last post: by
14 posts views Thread by Rochester | last post: by
3 posts views Thread by Jeremy Sanders | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.