changeset 27057:986128cf1e07

print.m: Fix error when using -tight but Ghostscript is not available (bug #56193). * print.m (epstool): Check whether using dos_shell, before checking whether Ghostscript is missing, before calculating persistent variable epsdevice (only used on Windows).
author Rik <rik@octave.org>
date Mon, 22 Apr 2019 17:33:51 -0700
parents 64461ccf3039
children f6e59ee37fee
files scripts/plot/util/print.m
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/print.m	Fri Apr 19 12:38:13 2019 +0000
+++ b/scripts/plot/util/print.m	Mon Apr 22 17:33:51 2019 -0700
@@ -764,9 +764,16 @@
   ## Unix Shell;
   ##   cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
 
+  dos_shell = (ispc () && ! isunix ());
+
   ## HACK: Keep track of whether ghostscript supports epswrite or eps2write.
   persistent epsdevice;
-  if (isempty (epsdevice))
+  if (dos_shell && isempty (epsdevice))
+    if (isempty (opts.ghostscript.binary))
+      error ("octave:print:missing_gs",
+             "print: Ghostscript is required for specified output format, but binary is not available in PATH");
+    endif
+
     [status, devlist] = system (sprintf ("%s -h", opts.ghostscript.binary));
     if (isempty (strfind (devlist, "eps2write")))
       epsdevice = "epswrite";
@@ -775,8 +782,6 @@
     endif
   endif
 
-  dos_shell = (ispc () && ! isunix ());
-
   cleanup = "";
   if (nargin < 3)
     fileout = opts.name;