diff --git a/packages/truffle-core/cli.js b/packages/truffle-core/cli.js index 83df39bc8e7..1edf1f668ed 100755 --- a/packages/truffle-core/cli.js +++ b/packages/truffle-core/cli.js @@ -39,4 +39,13 @@ command.run(process.argv.slice(2), options, function(err) { // Don't exit if no error; if something is keeping the process open, // like `truffle console`, then let it. + + // Clear any polling or open sockets - `provider-engine` in HDWallet + // and `web3 1.0 confirmations` both leave interval timers etc wide open. + const handles = process._getActiveHandles(); + handles.forEach(handle => { + if (typeof handle.close === 'function'){ + handle.close(); + } + }) });