NAME

Skilletor::Process - Run a program without a shell – cwd, environment, timeout, captured output

VERSION

version 0.001

SYNOPSIS

use Skilletor::Process qw( run_command );

my $r = run_command(
  cmd        => [ 'git', 'rev-parse', 'HEAD' ],
  cwd        => $dir,
  env        => \%env,          # the whole environment of the child
  timeout_ms => 60_000,
);
print $r->{stdout} if defined $r->{code} && $r->{code} == 0;

DESCRIPTION

What the reference gets from Node's execFile: a program and its arguments as a list (never a shell), a working directory, a complete environment, a timeout after which the child gets SIGTERM, and stdout and stderr captured as bytes. Nothing of the parent's state changes.

run_command

run_command( cmd => [...], cwd => $dir, env => \%env, timeout_ms => $ms );

Returns { code, signal, stdout, stderr, timed_out, spawn_error? }. code is undef when a signal ended the child. spawn_error ({ stage => 'chdir' | 'exec', errno, message }) says the program never ran: no such directory, no such program.

SUPPORT

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

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