[Gs-devel] pipe/redirect problem in GhostScript

Michael Jose Ceniza michael_joseceniza at hotmail.com
Sun Nov 18 23:46:49 PST 2001


I'm currently using ghostscript in a filter to print postscript files in my 
Lexmark printer. The input of ghostscript comes from stdin while the output 
is redirected to the Lexmark printer driver. The problem appears when the 
Lexmark driver terminates due to some error condition. What happens then is 
that I begin to see the resource usage of ghostscript increase... CPU usage 
goes near 100% and memory usage continually increasing and sometimes tops at 
126MB which is near the maximum limit of my physical RAM (which is 128MB). 
It seems that ghostscript cannot detect the SIGPIPE signal that the Lexmark 
driver generates when it closes the pipe. Does anybody know of any way to 
signal ghostscript to terminate given this kind of scenario. Attached is the 
script that I use to invoke ghostscript:

#!/bin/bash
#usage PS2Z33 <paper_size> <paperwidth>x<paperheight> <printres>x<printres>
DRV_PATH=/usr/local/Lexmark_Z33Driver


gs -sDEVICE=ppmraw -sOutputFile=- -sTargetPort=/dev/usb/lp0 
-sConfigFile=/var/spool/lexmark/Z33_layout_page.txt -dPaperSize=$1 -q -r$3 
-g$2 -dNOPAUSE -dMargins="{-18 -18}" - > /var/spool/lexmark/input_pipe

exit 0

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




More information about the gs-devel mailing list