NAME

POSIX::RT::Spawn - interface to the posix_spawn function

SYNOPSIS

use POSIX::RT::Spawn;

my $pid = spawn 'command', 'arg1', 'arg2'
    or die "failed to spawn: $!";
waitpid $pid, 0;
die "command failed with status: ", $?>>8 if $?;

DESCRIPTION

The POSIX::RT::Spawn module provides an interface to the posix_spawn(2) function for creating new processes.

FUNCTIONS

spawn

$pid = spawn 'echo', 'hello world'

Does exactly the same thing as system LIST, except the parent process does not wait for the child process to exit. Also, the return value is the child pid on success, or false on failure.

See "system" in perlfunc for more details.

SEE ALSO

http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html

TODO

  • Allow the user to alter posix_spawn settings using package variables, e.g. $POSIX::RT::Spawn::Flags{RESETIDS} = 1 or $POSIX::RT::Spawn::Flags |= &POSIX_SPAWN_RESETIDS

  • Allow the user to lexically replace the ops that use fork/exec (e.g. backticks, open, system) with versions that use posix_spawn.

COPYRIGHT AND LICENSE

Copyright (c) 2011 gray <gray at cpan.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

gray, <gray at cpan.org>