Skip to content

Instantly share code, notes, and snippets.

@yannk
Created October 1, 2009 06:04
Show Gist options
  • Save yannk/198754 to your computer and use it in GitHub Desktop.
Save yannk/198754 to your computer and use it in GitHub Desktop.
--- orig.pm 2009-09-30 22:58:25.000000000 -0700
+++ ../lib/AnyEvent/Util.pm 2009-09-30 22:58:04.000000000 -0700
@@ -468,10 +468,12 @@
=item $cv = run_cmd $cmd, key => value...
-Run a given external command, potentially redirecting file descriptors and
-return a condition variable that gets sent the exit status (like C<$?>)
-when the program exits I<and> all redirected file descriptors have been
-exhausted.
+Run a given external command, potentially redirecting file descriptors and,
+in scalar context, return a condition variable that gets sent the exit status
+(like C<$?>) when the program exits I<and> all redirected file descriptors
+have been exhausted.
+
+In scalar context, the pid of the child is returned in second position.
The C<$cmd> is either a single string, which is then passed to a shell, or
an arrayref, which is passed to the C<execvp> function.
@@ -719,7 +721,7 @@
undef $cw; $cv->end;
};
- $cv;
+ wantarray ? ($cv, $pid) : $cv;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment