Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Fire and forget under OS/2 (http://www.velocityreviews.com/forums/t952987-fire-and-forget-under-os-2-a.html)

Dave Saville 10-03-2012 05:25 PM

Fire and forget under OS/2
 
Trying to start a process as "fire and forget" ie I want the process
to just go off by itself and the invoking script to keep going and not
kill the invoked process when it exits.

Google around and it looks as if "system 'foo &'" should work. But
under OS/2 ECS it does not - even though, from the command line, "sh
foo &" from a sh prompt works as in *nix.

As an aside, "system foo&" with a "ps" in another window shows an
instance of sh with foo as child.
system "sh -c foo &" with a "ps" in another window shows *three*
instances of sh and one of foo in a straight chain of pids. Can't
figure why three and not two.

TIA
--
Regards
Dave Saville

Dave Saville 10-03-2012 06:33 PM

Re: Fire and forget under OS/2 - solved
 
On Wed, 3 Oct 2012 17:25:11 UTC, "Dave Saville" <dave@invalid.invalid>
wrote:

> Trying to start a process as "fire and forget" ie I want the process
> to just go off by itself and the invoking script to keep going and not
> kill the invoked process when it exits.
>
> Google around and it looks as if "system 'foo &'" should work. But
> under OS/2 ECS it does not - even though, from the command line, "sh
> foo &" from a sh prompt works as in *nix.
>
> As an aside, "system foo&" with a "ps" in another window shows an
> instance of sh with foo as child.
> system "sh -c foo &" with a "ps" in another window shows *three*
> instances of sh and one of foo in a straight chain of pids. Can't
> figure why three and not two.


Turned out to be a shell problem. Perl looks for sh. It found one, but
at some point in the past I had aliased it to ksh. Aliased pdksh to sh
and it works perfectly. :-)
--
Regards
Dave Saville

Dave Saville 10-04-2012 10:33 AM

Re: Fire and forget under OS/2
 
On Wed, 3 Oct 2012 21:34:07 UTC, Ben Morrow <ben@morrow.me.uk> wrote:

>
> Quoth "Dave Saville" <dave@invalid.invalid>:
> > Trying to start a process as "fire and forget" ie I want the process
> > to just go off by itself and the invoking script to keep going and not
> > kill the invoked process when it exits.

>
> perldoc perlos2 points you to OS2::Process, which suggests something like
>
> use OS2::Process;
>
> system P_NOWAIT | P_UNRELATED, "foo";
>
> may be what you want. I don't know what the difference is between the
> various constants you can use for that first argument; presumably this
> is explained in the OS/2 system documentation.
>


Hi Ben

Yes they are the same parms as some C functions use for starting
things. However, last night I had a brainwave as to why "system foo &"
did not work which google suggests should. Turns out that at some time
in the dim past I had copied ksh to sh. Having tried all the OS/2
shells I have knocking around pdksh works as one would expect on *nix.
Happy bunny.


--
Regards
Dave Saville


All times are GMT. The time now is 08:52 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.