Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

A few clarifications

NORMALLY: Smedge2 --executes--> Render.exe MY-WRAPPED VERSION: Smedge2 --executes--> --executes--> Render.exe

The problem being that when smedge2 decides that it should abort a job, it kills the process it executed, this would be fine if there was only one process (NORMALLY) , but MY-WRAPPED has smedge executing the wrapper, sadly when smedge kills '', the children of '' do not die. Moreover, no amount of signal trapping will catch the kill issued by smedge. Indeed it seems very similar to the Taskmanager->EndProcess.

Now the code, some of which is show below , does work when given a SIGINT from the commandline - ie
C:\wrappers\ -some args * - output etc * ^C In cleanup.
And so the child process is killed.
#!/usr/bin/perl -w $|++; open ( LOG , '>>c:\temp\wrapper.log' ); # debug print LOG "#"x40, $/; print LOG "PID : $$" , $/; print LOG join (',' , @ARGV) , $/; my $mayabatch = 'mayabatch'; $SIG{TERM}=\&cleanup; $SIG{KILL}=\&cleanup; $SIG{INT}=\&cleanup; $SIG{ABRT}=\&cleanup; $SIG{BREAK}=\&cleanup; $SIG{STOP}=\&cleanup; $SIG{QUIT}=\&cleanup; my %o; $o{-file} = shift @ARGV; my @args = @ARGV; while ( @args ) { my $arg = shift @args; if ($arg =~ /-ses/) { $o{-s} = shift @args; $o{-e} = shift @args; $o{-b} = shift @args; } elsif ( $arg =~ /^-/ ) { $o{$arg}=shift @args; } else { warn "Unhandled arg $arg \n"; } } # blah blah, operations on args to wrap # neatly. # my $child = open ( RENDER , "$command |" ) or die "Screaming $!$?\n"; while (<RENDER>) { print }; print "Child exit status was $?" , $/; exit $?; sub cleanup { warn "In cleanup. \n"; kill "HUP" , $child; }

I can't believe it's not psellchecked

In reply to Re: Re: Ways and means of killing Win32 processes by submersible_toaster
in thread Ways and means of killing Win32 processes by submersible_toaster

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (6)
    As of 2018-10-22 19:34 GMT
    Find Nodes?
      Voting Booth?
      When I need money for a bigger acquisition, I usually ...

      Results (122 votes). Check out past polls.