added some better error handling to change detection
[scpubgit/File-Tree-Snapshot.git] / lib / File / Tree / Snapshot.pm
index ec356d4..005a7c9 100644 (file)
@@ -63,7 +63,10 @@ sub create {
 sub _has_changes {
     my ($self) = @_;
     my $path = $self->storage_path;
-    my @changes = `cd $path && git diff --name-only --cached`;
+    my $cmd = qq{cd $path && git diff --name-only --cached};
+    CORE::open my $handle, '-|', $cmd
+      or die "Unable to find changes in ($cmd): $!\n";
+    my @changes = <$handle>;
     return scalar @changes;
 }