Skip to content

Commit

Permalink
Clear interval timers on command exit
Browse files Browse the repository at this point in the history
  • Loading branch information
cgewecke committed May 5, 2018
1 parent 850b955 commit eab7a6f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/truffle-core/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ command.run(process.argv.slice(2), options, function(err) {
}
process.exit(1);
}
console.log('Forcing exit...')
process.exit(0);

// Don't exit if no error; if something is keeping the process open,
// like `truffle console`, then let it.

// Clear any polling though - `provider-engine` in HDWallet
// and `web3 1.0 confirmations` both interval timers wide open.
const Timer = process.binding('timer_wrap').Timer;
const handles = process._getActiveHandles();
handles.forEach(handle => {
if (handle instanceof Timer){
handle.close();
}
})
});

0 comments on commit eab7a6f

Please sign in to comment.