Commit Diff


commit - 8c4930cfcef7c2310f05b7007f95750513e1fd79
commit + 3cf28f46d454a6b95131133179393b3ae6ac7ec4
blob - c71cc3fa34ba3306ee9a0510cd0e48a97fe2d324
blob + 11a98ed7d57df7a42b505816e14e8f208255173e
--- plass
+++ plass
@@ -148,7 +148,18 @@ sub got {
 }
 
 sub got_add {
-	return got 'add', '-I', shift;
+	my $file = shift;
+
+	open (my $null, '>', '/dev/null') or die "can't open /dev/null: $!";
+	open (my $stderr, ">&", STDERR) or die "can't save stderr: $!";
+	open (STDERR, ">&", $null) or die "can't redirect stderr: $!";
+
+	got 'info', $file;
+	my $found = !$?;
+
+	open (STDERR, ">&", $stderr) or die "can't restore stderr: $!";
+
+	return $found ? 1 : (got 'add', '-I', $file);
 }
 
 sub got_rm {