This repository was archived by the owner on May 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -464,9 +464,8 @@ module.exports = function(proto) {
464464 }
465465
466466 // Setup timeout if requested
467- var processTimer ;
468467 if ( self . options . timeout ) {
469- processTimer = setTimeout ( function ( ) {
468+ self . processTimer = setTimeout ( function ( ) {
470469 var msg = 'process ran into a timeout (' + self . options . timeout + 's)' ;
471470
472471 emitEnd ( new Error ( msg ) , stdoutRing . get ( ) , stderrRing . get ( ) ) ;
@@ -533,6 +532,7 @@ module.exports = function(proto) {
533532 } ,
534533
535534 function endCB ( err , stdoutRing , stderrRing ) {
535+ clearTimeout ( self . processTimer ) ;
536536 delete self . ffmpegProc ;
537537
538538 if ( err ) {
Original file line number Diff line number Diff line change @@ -280,6 +280,18 @@ describe('Processor', function() {
280280 . saveToFile ( testFile ) ;
281281 } ) ;
282282
283+ it ( 'should not keep node process running on completion' , function ( done ) {
284+ var script = `
285+ var ffmpeg = require('.');
286+ ffmpeg('${ this . testfilebig } ', { timeout: 60 })
287+ .addOption('-t', 1)
288+ .addOption('-f', 'null')
289+ .saveToFile('/dev/null');
290+ ` ;
291+
292+ exec ( `node -e "${ script } "` , { timeout : 1000 } , done ) ;
293+ } ) ;
294+
283295 it ( 'should kill the process with .kill' , function ( done ) {
284296 var testFile = path . join ( __dirname , 'assets' , 'testProcessKill.avi' ) ;
285297 this . files . push ( testFile ) ;
You can’t perform that action at this time.
0 commit comments