Placing the open() call inside the do{} struct will automatically close the
filehandle if possible.
Placing the close() call outside the do{} struct is useless and will make it
fail systematically
Change the error message to state that what fails is a fork(), not a file
opening.
Use autodie to properly exit when a print or open call fails.
Signed-off-by: Célestin Matte <redacted>
Signed-off-by: Matthieu Moy <redacted>
---
contrib/mw-to-git/git-remote-mediawiki.perl | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 952ddcc..20ddccb 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -23,6 +23,7 @@ binmode STDOUT, ':encoding(UTF-8)';
use URI::Escape;
use Readonly;
+use autodie;
# Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced
Readonly my $SLASH_REPLACEMENT => '%2F';
@@ -363,8 +364,6 @@ sub run_git {
local $/ = undef;
<$git>
};
- close($git);
-
return $res;
}
--
1.7.9.5