File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ PDF.prototype.toStream = function PdfToStream (callback) {
63
63
}
64
64
65
65
stream . on ( 'end' , function ( ) {
66
- fs . unlink ( res . filename , function ( err ) {
66
+ fs . unlink ( res . filename , function unlinkPdfFile ( err ) {
67
67
if ( err ) console . log ( 'html-pdf:' , err )
68
68
} )
69
69
} )
@@ -134,15 +134,15 @@ PDF.prototype.exec = function PdfExec (callback) {
134
134
child . on ( 'error' , function onError ( err ) { respond ( null , err ) } )
135
135
136
136
// An exit event is most likely an error because we didn't get any data at this point
137
+ child . on ( 'close' , respond )
137
138
child . on ( 'exit' , respond )
138
139
139
140
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 ( )
141
143
}
142
144
143
145
function kill ( child , onData , onError ) {
144
- child . stdout . removeListener ( 'data' , onData )
145
- child . stderr . removeListener ( 'data' , onError )
146
146
child . stdin . end ( )
147
147
child . kill ( )
148
148
}
You can’t perform that action at this time.
0 commit comments