Rand Stats

Proc::Easy

zef:tbrowder

Actions Status

NAME

Proc::Easy - Provides routine run-command to ease using Raku's Proc class.

NOTE: This module replaces the run-command portion of the deprecated module Proc::More. Note also the API has changed slightly: the previous :$all option was removed and its behavior is now the default (i.e., all three of the output parameter values are returned as a list of three elements unless only one is selected as an option).

SYNOPSIS

    use Proc::Easy;
    my $cmd = "some-user-prog arg1 arg2";
    my $other-dir = $*TMPDIR";
    my ($exitcode, $stderr, $stdout) = run-command $cmd, :dir($other-dir);

DESCRIPTION

Proc::Easy is designed to make using the run routine from class Proc easier for the usual, simple case when the myriad ways to use Proc's run are not required.

sub run-command

sub run-command(Str:D $cmd,
		:$exit,
                :$err,
		:$out,
		:$dir, # run command in dir 'dir'
		:$debug,
	       ) is export {...}

Parameters:

Returns:

A three-element list of the exit code and results from stderr and stdout, respectively. Either of the three may be selected individually if desired. (If more than one is selected, only one is returned in the order of exit code, stderr, or stdout.) There is also the capability to send debug messages to stdout by including the :$debug option.

AUTHOR

Tom Browder tbrowder@cpan.org

COPYRIGHT and LICENSE

Copyright © 2017-2021 Tom Browder

This library is free software; you may redistribute or modify it under the Artistic License 2.0.