Wed Mar 25 13:39:44 2009: Request 44567 was acted upon.
Transaction: Ticket created by yulmathieu
       Queue: Win32-Process
     Subject: (No subject given)
   Broken in: 0.14
    Severity: Important
       Owner: Nobody
  Requestors: math...@closetwork.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=44567 >


When running as a service (using perlsvc), if the service opens STDIN,
STDOUT or STDERR to some file, any process ran using Win32::Process will
not inherit the file handles. 

This bug previously reported it, and offered a patch:
https://rt.cpan.org/Public/Bug/Display.html?id=30573

Here's how to reproduce it.

Create a directory, download this snippet into the file testservice.pl

 http://pastebin.com/m78325af

Then this snippet into job.pl

 http://pastebin.com/m3dc56344

Compile testservice.pl as a service in a console window:

 perlapp --force job.pl
 perlsvc --force testservice.pl

Now, if you run testservice.exe directly:

 testservice.exe

and you look into the newly created job.log file, you should see this:

  Wed Mar 25 12:58:37 2009: [from service] test stdout. Fileno:1
  Wed Mar 25 12:58:37 2009: [from service] test stderr. Fileno:2
  Wed Mar 25 12:58:37 2009: Starting Win32::Process
 Next, you should see two lines from the process.
 job.exe Win32::Process: Testing stderr.
 job.exe Win32::Process: Testing stdout.

Over and over again.
But if you start it as a service:

 testservice.exe --install auto

you will see this in job.log, missing the output from the job.exe.

 Wed Mar 25 12:58:37 2009: [from service] test stdout. Fileno:1
 Wed Mar 25 12:58:37 2009: [from service] test stderr. Fileno:2
 Wed Mar 25 12:58:37 2009: Starting Win32::Process
 Next, you should see two lines from the process.

In testservice.log, I open STDOUT and STDERR towards job.log, right
before starting job.exe, So job.exe's output should be in job.log, but
that doesn't work with a service, for some reason.

Reply via email to