File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ PDF.prototype.toStream = function PdfToStream (callback) {
6363 }
6464
6565 stream . on ( 'end' , function ( ) {
66- fs . unlink ( res . filename , function ( err ) {
66+ fs . unlink ( res . filename , function unlinkPdfFile ( err ) {
6767 if ( err ) console . log ( 'html-pdf:' , err )
6868 } )
6969 } )
@@ -134,15 +134,15 @@ PDF.prototype.exec = function PdfExec (callback) {
134134 child . on ( 'error' , function onError ( err ) { respond ( null , err ) } )
135135
136136 // An exit event is most likely an error because we didn't get any data at this point
137+ child . on ( 'close' , respond )
137138 child . on ( 'exit' , respond )
138139
139140 var config = JSON . stringify ( { html : this . html , options : this . options } )
140- return child . stdin . write ( config + '\n' , 'utf8' )
141+ child . stdin . write ( config + '\n' , 'utf8' )
142+ child . stdin . end ( )
141143}
142144
143145function kill ( child , onData , onError ) {
144- child . stdout . removeListener ( 'data' , onData )
145- child . stderr . removeListener ( 'data' , onError )
146146 child . stdin . end ( )
147147 child . kill ( )
148148}
You can’t perform that action at this time.
0 commit comments