Source: markdown
Version: 1.0.2~b8-3
Severity: wishlist
Tags: patch
Hi,
$ markdown does-not-exist
Can't open does-not-exist: No such file or directory at /usr/bin/markdown
line 221.
Use of uninitialized value $text in substitution (s///) at /usr/bin/markdown
line 248.
Use of uninitialized value $text in substitution (s///) at /usr/bin/markdown
line 249.
$ echo $?
0
This would appear to violate UNIX principles, etc. Instead, please make
/usr/bin/markdown exit with a non-zero exit code if cannot open the input
file.
Patch attached.
Best wishes,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/Markdown.pl b/Markdown.pl
index 9f85caa..013cd6c 100755
--- a/Markdown.pl
+++ b/Markdown.pl
@@ -228,7 +228,7 @@ elsif (! $g_perl_module) {
my $text;
{
local $/; # Slurp the whole file
- $text = <>;
+ defined($text = <>) or exit 2;
}
print Markdown($text);
}