How to use node-cleanup - 10 common examples

To help you get started, we’ve selected a few node-cleanup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gramps-graphql / gramps-cli / src / dev.js View on Github external
// If something went wrong loading data sources, log it, tidy up, and die.
      console.error(error);
      await cleanUpTempDir();
      process.exit(2); // eslint-disable-line no-process-exit
    }
  }

  startGateway({
    mock,
    gateway,
    dataSourcePaths,
    loadedDataSources,
  });
};

cleanup(cleanupOnExit);
github bruce-c-liu / Algorithms-Study-Helper / index.js View on Github external
nodeCleanup(function (exitCode, signal) {
  entries = JSON.stringify(entries, null, '\t');
  fs.writeFileSync('entries.json', entries);

  if (signal) {
    // RECEIVES SIGHUP IF TERMINAL IS CLOSED
    console.log('Got signal: ', signal);
    console.log('Exiting...');
    nodeCleanup.uninstall(); // don't call cleanup handler again
    process.kill(process.pid, signal);
    return false;
  } else {
    // console.log('In cleanup. Exit code is', exitCode);
    console.log('Exiting...');
  }
});
github harpagon210 / steemsmartcontracts / benchmarks / load.js View on Github external
nodeCleanup((exitCode, signal) => {
  if (signal) {
    console.log('Closing App... ', exitCode, signal); // eslint-disable-line

    stopApp();

    nodeCleanup.uninstall(); // don't call cleanup handler again
    return false;
  }

  return true;
});
github gilamran / tsc-watch / lib / tsc-watch.js View on Github external
nodeCleanup((_exitCode, signal) => {
  tscProcess.kill(signal);
  killProcesses(true).then(() => process.exit());
  // don't call cleanup handler again
  nodeCleanup.uninstall();
  return false;
});
github hmmhmmhm / dva-engine / bin / core / transform / watch.ts View on Github external
nodeCleanup((_exitCode, signal) => {
    tscProcess.kill(signal)
    killProcesses(true).then(() => process.exit())

    // don't call cleanup handler again
    nodeCleanup.uninstall()

    return false
})
github harpagon210 / steemsmartcontracts / app.js View on Github external
nodeCleanup((exitCode, signal) => {
  if (signal) {
    logger.info(`Closing App...  exitCode: ${exitCode} signal: ${signal}`);

    stopApp(signal);

    nodeCleanup.uninstall(); // don't call cleanup handler again
    return false;
  }

  return true;
});
github gramps-graphql / gramps-cli / src / lib / cleanup-on-exit.js View on Github external
export default (_, signal) => {
  // Uninstall the handler to prevent an infinite loop.
  cleanup.uninstall();

  // Delete the temporary directory.
  const shouldPrintShutdownMessage = cleanUpTempDir();

  if (shouldPrintShutdownMessage) {
    success('Successfully shut down. Thanks for using GrAMPS!');
  }

  process.kill(process.pid, signal);

  return false;
};
github adishegde / media_hub / src / cli / daemon.js View on Github external
let stopped = Object.values(server.stop());
        Promise.all(stopped)
            .then(
                val => {
                    logger.info(
                        "index.js: Cleaned all resources. Shutting down."
                    );
                },
                err => {
                    logger.error(`index.js: ${err}`);
                }
            )
            .then(() => {
                process.kill(process.pid, signal);
            });
        NodeCleanup.uninstall();
        return false;
    }
});

node-cleanup

installs custom cleanup handlers that run on exiting node

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis

Popular node-cleanup functions