use Cwd qw/abs_path/;
use File::Temp qw/tempfile/;
-use POSIX qw/WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG SIGINT SIGQUIT/;
+use File::Spec (); # curdir, catfile
+use POSIX qw/WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG/;
BEGIN {
no warnings 'redefine';
*WIFEXITED = sub { 1 } unless eval { WIFEXITED(0); 1 };
*WEXITSTATUS = sub { shift() >> 8 } unless eval { WEXITSTATUS(0); 1 };
*WIFSIGNALED = sub { shift() & 127 } unless eval { WIFSIGNALED(0); 1 };
+ *WTERMSIG = sub { shift() & 127 } unless eval { WTERMSIG(0); 1 };
}
use base qw/Exporter/;
my @ret = (1, '');
-CHECK:
+TRY:
{
my @args = (
abs_path($filename),
'version',
);
- my $git = 't/bin/git';
+ my $git = File::Spec->catfile(File::Spec->curdir, qw/t bin git/);
if ($^O eq 'MSWin32') {
unless (-x $git) {
$git .= '.bat';
unless (-x $git) {
@ret = (0, "no $git executable");
- last CHECK;
+ last TRY;
}
}
} else {
unless (-x $git) {
@ret = (0, "no $git executable");
- last CHECK;
+ last TRY;
}
}
if ($? == -1) {
@ret = (0, $! || "unknown");
- last CHECK;
+ last TRY;
}
my $status;