Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async dispose () {
if (!USED_TEMP_DIRS[this.path])
return;
this.lockFile.dispose();
await cleanupProcess.removeDirectory(this.path);
delete USED_TEMP_DIRS[this.path];
}
}
// NOTE: exposed for testing purposes
TempDirectory.TEMP_DIRECTORIES_ROOT = TESTCAFE_TMP_DIRS_ROOT;
setupExitHook(TempDirectory.disposeDirectoriesSync);
var debug = require("debug")("blot:build");
var helper = require("helper");
var clfdate = helper.clfdate;
var workers = [];
var jobs = {};
debug("Master", process.pid, "is running");
exitHook(function() {
debug("Shutting down master:", process.pid);
workers.forEach(function(item) {
item.worker.kill();
});
});
exitHook.uncaughtExceptionHandler(function(err) {
console.error(err);
workers.forEach(function(item) {
item.worker.kill();
});
});
function messageHandler(id) {
return function(message) {
debug("Handling message", id);
var err = null;
// Ressurrect error from string. You can remove
// this when we can pass something with type Error
// between child processes in future.
if (message.err) {
try {
* Returns cleanup function
*/
async function boot(constants: typeof constantsType): Promise {
const manager = new AppManager(
appConfig,
logger,
versionBuild,
genesisBlock,
constants,
allExceptionCreator
);
await manager.boot();
return manager;
}
exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
logger.fatal('Unhandled Promise rejection', err);
});
boot(constantsType)
.catch((err) => {
logger.fatal('Error when instantiating');
logger.fatal(err);
process.exit(1);
return Promise.reject(err);
})
.then((manager) => {
exitHook((cb) => promiseToCB(manager.tearDown(), cb));
});
logger.log(
'warn',
`--> Failed to report unexpected closure to runnerty.io. ${err}`
);
}
}
process.on('uncaughtException', err => {
if (err.code === 'EADDRINUSE') {
logger.log('error', `Unable to start server: ${err.message}`);
} else {
logger.log('error', err.message);
}
});
exitHook.unhandledRejectionHandler(err => {
logger.log('error', err);
});
exitHook(callback => {
preExit().then(_ => {
callback();
});
});
*/
async function boot(constants: typeof constantsType): Promise {
const manager = new AppManager(
appConfig,
logger,
versionBuild,
genesisBlock,
constants,
allExceptionCreator
);
await manager.boot();
return manager;
}
exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
logger.fatal('Unhandled Promise rejection', err);
});
boot(constantsType)
.catch((err) => {
logger.fatal('Error when instantiating');
logger.fatal(err);
process.exit(1);
return Promise.reject(err);
})
.then((manager) => {
exitHook((cb) => promiseToCB(manager.tearDown(), cb));
});
* Takes care of bootstrapping the application
* Returns cleanup function
*/
async function boot(): Promise {
const manager = new AppManager(
appConfig,
logger,
callingPackageJSON.version,
genesisBlock,
modules
);
await manager.boot();
return manager;
}
exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
logger.fatal('Unhandled Promise rejection', err);
});
boot()
.catch((err) => {
logger.fatal('Error when instantiating');
logger.fatal(err);
return Promise.reject(err);
})
.then((manager) => {
exitHook((cb) => promiseToCB(manager.tearDown(), cb));
});
export function setForceExitTimeout(ms: number): void {
exitHook.forceExitTimeout(ms);
}
* Returns cleanup function
*/
async function boot(): Promise {
const manager = new AppManager(
appConfig,
logger,
callingPackageJSON.version,
genesisBlock,
modules
);
await manager.boot();
return manager;
}
exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
logger.fatal('Unhandled Promise rejection', err);
});
boot()
.catch((err) => {
logger.fatal('Error when instantiating');
logger.fatal(err);
return Promise.reject(err);
})
.then((manager) => {
exitHook((cb) => promiseToCB(manager.tearDown(), cb));
});