You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/hydro/development.js

27 lines
687 B
JavaScript

process.stdin.setEncoding('utf8');
5 years ago
process.stdin.on('data', async (input) => {
try {
5 years ago
const t = eval(input.toString().trim()); // eslint-disable-line no-eval
if (t instanceof Promise) console.log(await t);
else console.log(t);
} catch (e) {
console.warn(e);
}
});
process.on('unhandledRejection', (e) => console.log(e));
global.onDestory = [];
async function terminate() {
for (const task of global.onDestory) {
// eslint-disable-next-line no-await-in-loop
await task();
}
process.exit(0);
}
process.on('SIGINT', terminate);
5 years ago
5 years ago
require('./loader').load().catch((e) => {
console.error(e);
process.exit(1);
5 years ago
});