Changes for version 0.07 - 2026-11-07
- For Proc::Spawner, which delegates its redirections to Run where there is neither posix_spawn nor fork.
- Run::start(SPAWN, \@ARGS, REDIRS, \@ERRS, PROG) is public: PROG (optional) is the program to run when it is not $ARGS[0], as "system { PROG } LIST"; also through launch(), spawn_nowait() and fork_kid(). REDIRS may be what redir_list() takes; files it opens are closed after the start.
- Redirection specs {fd => M} (a copy of fd M as it is at that point) and {close => 1}, instead of the 2-argument strings ">&M", ">&-".
- Win32: Perl has no fcntl there, and close-on-exec is a handle that is not inherited; read and set through Win32API::File (which comes with Perl there): copies above a number by dup (no F_DUPFD), is_cloexec read, not inferred. Before, the forkless code died there at the first fcntl. Checked under Wine with Strawberry Perl 5.38.2: a program other than argv[0], a file on fd 1 with 2>&1, fd 0 closed, a missing program, our fds put back. Arguments go to Perl as they are: Perl's command line does not quote them as the C runtime parses them back (a bug of Perl's, to be reported).
- $Run::AsWin32 (true on Win32; RUN_AS_WIN32=1 or set it on Unix, for debugging): the Win32 code paths, with FD_CLOEXEC standing in for the handle's inheritance on Unix (os_inherit()), so all but the Win32API::File calls run and are tested there. The whole suite passes so, and Proc::Spawner's through Run; a dup loop broken on purpose fails t/win32.t on Linux. New tests: t/start.t (also: a file start() opens is closed again; checked to fail when the handle is kept), t/win32.t (Win32 only; under Wine 13 pass and the argv test is TODO; with 0.06 it dies at the first copy of an fd: "Your vendor has not defined Fcntl macro F_DUPFD"; on Unix it runs with $Run::AsWin32), t/as-win32.t (every other test file again with RUN_AS_WIN32=1, one test per file; skipped on Win32).
- The documentation brought up to date: the three layers (spawn, the command trees, Run::start), every constructor and the keys of run's data (errs, env, redir, pids, result), all the redirection specs, Win32; spawn returns undef on failure (not 0, as it said). README rewritten; Makefile.PL with abstract, author, prerequisites (Perl 5.10.1), repository.
- Licence stated: the same terms as Perl itself (GPL 1 or later, or the Artistic License); before, no version said.
- Tests quiet under prove: t/forkless.t's meant "exit 1" no longer prints its message, t/win32.t's line about the mode is a note, and t/as-win32.t shows a file's STDERR only when that file fails.
Modules
start programs in the background, and run command trees (and, or, chains, pipelines, redirections) without a shell