fix bug that in CGI reposito...
|
1 |
package Gitprep::Util; |
2 |
|
|
3 |
use strict; |
|
4 |
use warnings; |
|
5 |
use IPC::Open3 (); |
|
6 |
use File::Spec; |
|
7 |
|
|
8 |
sub run_command { |
|
9 |
my @cmd = @_; |
|
10 |
|
|
11 |
# Run command(Suppress STDOUT and STDERR) |
|
12 |
my($wfh, $rfh, $efh); |
|
13 |
my $pid = IPC::Open3::open3($wfh, $rfh, $efh, @cmd); |
|
14 |
close $wfh; |
|
15 |
() = <$rfh>; |
|
16 |
waitpid($pid, 0); |
|
17 |
|
|
18 |
my $child_exit_status = $? >> 8; |
|
19 |
|
|
20 |
return $child_exit_status == 0 ? 1 : 0; |
|
21 |
} |
|
22 |
|
|
23 |
1; |