File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ PDF.prototype.exec = function PdfExec (callback) {
120120 if ( code === null ) kill ( child , onData , onError )
121121
122122 // Since code has a truthy/falsy value of either 0 or 1, check for existence first.
123- // Ignore if code has a value of 0 since that means PhantomJS has executed and exited successfully.
124123 // Also, as per your script and standards, having a code value of 1 means one can always assume that
125124 // an error occured.
126125 if ( ( ( typeof code !== 'undefined' && code !== null ) && code !== 0 ) || err || ( code === 0 && ! data ) ) {
@@ -153,6 +152,9 @@ PDF.prototype.exec = function PdfExec (callback) {
153152
154153 // An exit event is most likely an error because we didn't get any data at this point
155154 child . on ( 'close' , respond )
155+ // According to child process documentation (https://nodejs.org/docs/latest-v14.x/api/child_process.html#child_process_event_exit),
156+ // exit event can fire before stdio is closed. Thus, it's probably not a good idea to subscribe to exit event at all.
157+ // on('close') above should be sufficient
156158 // child.on('exit', respond)
157159
158160 var config = JSON . stringify ( { html : this . html , options : this . options } )
You can’t perform that action at this time.
0 commit comments