| 1 | package BioSAILs::Utils; | ||
| 2 | |||
| 3 | use Moose::Role; | ||
| 4 | use namespace::autoclean; | ||
| 5 | |||
| 6 | use IPC::Cmd qw[can_run run run_forked]; | ||
| 7 | |||
| 8 | =head3 run_short_command | ||
| 9 | |||
| 10 | This function is for running quick running commands that we don't need to buffer | ||
| 11 | the output for. | ||
| 12 | |||
| 13 | A long running command is given in | ||
| 14 | HPC::Runner::Command::submit_jobs::Utils::Scheduler::Submit | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | ##TODO I have this function all over the place | ||
| 19 | |||
| 20 | sub run_short_command { | ||
| 21 | my $self = shift; | ||
| 22 | my $cmd = shift; | ||
| 23 | |||
| 24 | my( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = | ||
| 25 | run( command => $cmd, verbose => 0 ); | ||
| 26 | |||
| 27 | return { | ||
| 28 | exit_code => $success, | ||
| 29 | error_message => $error_message, | ||
| 30 | full_buffer => $full_buf, | ||
| 31 | stdout_buffer => $stdout_buf, | ||
| 32 | stderr_buffer => $stderr_buf, | ||
| 33 | }; | ||
| 34 | } | ||
| 35 | |||
| 36 | 1; |