in reply to Re: Using SIG{ALRM} within while loop.
in thread Using SIG{ALRM} within while loop.
my $proc = Proc::Async.new: "bash", "-c", "echo \"Hallo, sleeping for 120 seconds ...\"; sleep 120"; react { whenever $proc.stdout.lines { # Act on output from command. In this case, we just print it. say ‘line: ’, $_ } whenever Supply.interval(10) { # Handler. Occurs every 10 seconds. say "In handler..." } whenever $proc.start { say ‘Proc finished: exitcode=’, .exitcode, ‘ signal=’, .signal; # Gracefully jump from the react block. # Also stops the handler! done; } whenever Promise.in(300) { # Optional time-out code that fires in 300 seconds [5 minutes] # Handle as you see fit, but it's probably best to end with: done; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using SIG{ALRM} within while loop.
by evroom (Novice) on Jul 24, 2019 at 11:23 UTC |