Fire and forget under OS/2

Discussion in 'Perl Misc' started by Dave Saville, Oct 3, 2012.

  1. Dave Saville

    Dave Saville Guest

    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, Oct 3, 2012
    #1
    1. Advertising

  2. Dave Saville

    Dave Saville Guest

    Re: Fire and forget under OS/2 - solved

    On Wed, 3 Oct 2012 17:25:11 UTC, "Dave Saville" <>
    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, Oct 3, 2012
    #2
    1. Advertising

  3. Dave Saville

    Dave Saville Guest

    On Wed, 3 Oct 2012 21:34:07 UTC, Ben Morrow <> wrote:

    >
    > Quoth "Dave Saville" <>:
    > > 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
     
    Dave Saville, Oct 4, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Barrett

    Asynchronous Fire-And-Forget Call

    Stephen Barrett, Apr 11, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    1,019
    Stephen Barrett
    Apr 13, 2006
  2. Ames Andreas (MPA/DF)
    Replies:
    0
    Views:
    328
    Ames Andreas (MPA/DF)
    Aug 5, 2004
  3. Braulio Diez
    Replies:
    4
    Views:
    635
    Braulio Diez
    Feb 9, 2008
  4. Michael Ulm

    process fire and forget?

    Michael Ulm, Nov 29, 2004, in forum: Ruby
    Replies:
    1
    Views:
    166
    Yukihiro Matsumoto
    Nov 29, 2004
  5. U.Mutlu

    freeze and forget it :-)

    U.Mutlu, Feb 12, 2012, in forum: C++
    Replies:
    4
    Views:
    302
    Jorgen Grahn
    Feb 12, 2012
Loading...

Share This Page