Commit adbaa54ad43ffb3fd436704d621fe0df9562987b
Committed by
Jay Berkenbilt
1 parent
951dbc3b
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...
Showing
1 changed file
with
7 additions
and
5 deletions
qpdf/qtest/qpdf.test
| ... | ... | @@ -2,10 +2,11 @@ |
| 2 | 2 | require 5.008; |
| 3 | 3 | BEGIN { $^W = 1; } |
| 4 | 4 | use strict; |
| 5 | -use File::Copy; | |
| 6 | -use File::Basename; | |
| 7 | 5 | use Cwd; |
| 8 | 6 | use Digest::MD5; |
| 7 | +use File::Basename; | |
| 8 | +use File::Copy; | |
| 9 | +use File::Spec; | |
| 9 | 10 | |
| 10 | 11 | chdir("qpdf") or die "chdir testdir failed: $!\n"; |
| 11 | 12 | |
| ... | ... | @@ -13,6 +14,7 @@ require TestDriver; |
| 13 | 14 | |
| 14 | 15 | cleanup(); |
| 15 | 16 | |
| 17 | +my $devNull = File::Spec->devnull(); | |
| 16 | 18 | my $td = new TestDriver('qpdf'); |
| 17 | 19 | |
| 18 | 20 | my $compare_images = 1; |
| ... | ... | @@ -29,7 +31,7 @@ if ($compare_images) |
| 29 | 31 | { |
| 30 | 32 | # check for working acroread |
| 31 | 33 | if (system("acroread -toPostScript -pairs good1.pdf a.ps" . |
| 32 | - " >/dev/null 2>&1") == 0) | |
| 34 | + " >$devNull 2>&1") == 0) | |
| 33 | 35 | { |
| 34 | 36 | $have_acroread = 1; |
| 35 | 37 | } |
| ... | ... | @@ -2247,7 +2249,7 @@ sub compare_pdfs |
| 2247 | 2249 | $td->runtest("convert original file to image", |
| 2248 | 2250 | {$td->COMMAND => |
| 2249 | 2251 | "(cd tif1;" . |
| 2250 | - " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff24nc" . | |
| 2252 | + " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" . | |
| 2251 | 2253 | " -sOutputFile=a.tif - < ../$f1)"}, |
| 2252 | 2254 | {$td->STRING => "", |
| 2253 | 2255 | $td->EXIT_STATUS => 0}); |
| ... | ... | @@ -2266,7 +2268,7 @@ sub compare_pdfs |
| 2266 | 2268 | $td->runtest("convert new file to image", |
| 2267 | 2269 | {$td->COMMAND => |
| 2268 | 2270 | "(cd tif2;" . |
| 2269 | - " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff24nc" . | |
| 2271 | + " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" . | |
| 2270 | 2272 | " -sOutputFile=a.tif - < ../$f2)"}, |
| 2271 | 2273 | {$td->STRING => "", |
| 2272 | 2274 | $td->EXIT_STATUS => 0}); | ... | ... |