Initial script infrastructure
[scpubgit/Tak.git] / lib / Tak / CommandService.pm
CommitLineData
b96be97f 1package Tak::CommandService;
2
3use Capture::Tiny qw(capture);
4use IPC::System::Simple qw(runx EXIT_ANY);
5use Moo;
6
7with 'Tak::Role::Service';
8
9sub handle_exec {
10 my ($self, $command) = @_;
11 my $code;
12 my ($stdout, $stderr) = capture {
13 $code = runx(EXIT_ANY, @$command);
14 };
15 return { stdout => $stdout, stderr => $stderr, exit_code => $code };
16}
17
181;