open pipe for system call does not work on windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    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.
  • Jeff Dunn

    #2
    Re: open pipe for system call does not work on windows

    lucid1@mediaone .net (Brian) wrote in message news:<961d6f35. 0403221524.6848 dd26@posting.go ogle.com>...[color=blue]
    > '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.[/color]

    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

    Comment

    • Will Stranathan

      #3
      Re: open pipe for system call does not work on windows

      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:[color=blue]
      > '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.[/color]

      Comment

      • nobull@mail.com

        #4
        Re: open pipe for system call does not work on windows

        lucid1@mediaone .net (Brian) wrote in message news:<961d6f35. 0403221524.6848 dd26@posting.go ogle.com>...[color=blue]
        > '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.[/color]

        No that is not necessary - you can re-open STDOUT to a file then just
        use system().
        [color=blue]
        > On Windows my script locks up after the first job is done. It works
        > fine on unix.[/color]

        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.
        [color=blue]
        > I am using fork to spawnt the child processes.[/color]

        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.

        Comment

        • Brian

          #5
          Re: open pipe for system call does not work on windows

          Thanks for all the comments.

          Comment

          Working...