aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Schöning <tschoening@users.noreply.github.com>2015-11-23 10:50:10 +0100
committerJay Berkenbilt <ejb@ql.org>2016-01-24 17:52:09 +0100
commitadbaa54ad43ffb3fd436704d621fe0df9562987b (patch)
tree88cf9bad218d89eca6449c6a4f674010220972d8
parent951dbc3b7f58c4718514650130fbe7c543b68e4d (diff)
downloadqpdf-adbaa54ad43ffb3fd436704d621fe0df9562987b.tar.zst
Fix non-portable use of /dev/null
/dev/null is not portable, so use File::Spec instead, which provides portable "paths" and especially "nul" on Windows. I changed all places with hard coded /dev/null to be sure, while I think it only is a problem in direct system calls, because the other executed commands go to sh.exe from MSYS which itself should port /dev/null to NUL. The test still pass, so shouldn't have made any harm...
-rw-r--r--qpdf/qtest/qpdf.test12
1 files changed, 7 insertions, 5 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index cfb3fa0d..8d4f0638 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -2,10 +2,11 @@
require 5.008;
BEGIN { $^W = 1; }
use strict;
-use File::Copy;
-use File::Basename;
use Cwd;
use Digest::MD5;
+use File::Basename;
+use File::Copy;
+use File::Spec;
chdir("qpdf") or die "chdir testdir failed: $!\n";
@@ -13,6 +14,7 @@ require TestDriver;
cleanup();
+my $devNull = File::Spec->devnull();
my $td = new TestDriver('qpdf');
my $compare_images = 1;
@@ -29,7 +31,7 @@ if ($compare_images)
{
# check for working acroread
if (system("acroread -toPostScript -pairs good1.pdf a.ps" .
- " >/dev/null 2>&1") == 0)
+ " >$devNull 2>&1") == 0)
{
$have_acroread = 1;
}
@@ -2247,7 +2249,7 @@ sub compare_pdfs
$td->runtest("convert original file to image",
{$td->COMMAND =>
"(cd tif1;" .
- " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff24nc" .
+ " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" .
" -sOutputFile=a.tif - < ../$f1)"},
{$td->STRING => "",
$td->EXIT_STATUS => 0});
@@ -2266,7 +2268,7 @@ sub compare_pdfs
$td->runtest("convert new file to image",
{$td->COMMAND =>
"(cd tif2;" .
- " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff24nc" .
+ " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" .
" -sOutputFile=a.tif - < ../$f2)"},
{$td->STRING => "",
$td->EXIT_STATUS => 0});