Commit | Line | Data |
---|---|---|
b96be97f | 1 | package Tak::CommandService; |
2 | ||
3 | use Capture::Tiny qw(capture); | |
4 | use IPC::System::Simple qw(runx EXIT_ANY); | |
5 | use Moo; | |
6 | ||
7 | with 'Tak::Role::Service'; | |
8 | ||
9 | sub 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 | ||
18 | 1; |