Skip to content

Instantly share code, notes, and snippets.

@yannk
Created October 1, 2009 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yannk/199066 to your computer and use it in GitHub Desktop.
Save yannk/199066 to your computer and use it in GitHub Desktop.
--- lib/AnyEvent/orig.pm 2009-10-01 08:55:59.000000000 -0700
+++ lib/AnyEvent/Util.pm 2009-10-01 09:02:05.000000000 -0700
@@ -537,6 +537,10 @@
See C<close_all_fds_except> for more details.
+=item pidref => \$scalar
+
+A reference to a scalar where to store the pid of the run command.
+
=back
Example: run C<rm -rf />, redirecting standard input, output and error to
@@ -546,6 +550,7 @@
"<", "/dev/null",
">", "/dev/null",
"2>", "/dev/null";
+ pidref => \my $pid,
$cv->recv and die "d'oh! something survived!"
Example: run F<openssl> and create a self-signed certificate and key,
@@ -712,6 +717,9 @@
POSIX::_exit (126);
}
+ if (exists $arg{pidref}) {
+ ${$arg{pidref}} = $pid;
+ }
%redir = (); # close child side of the fds
my $status;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment