graceful-sync.js 319 B

123456789101112131415161718192021
  1. var
  2. tmp = require('../lib/tmp'),
  3. spawn = require('./spawn-sync');
  4. var graceful = spawn.arg;
  5. if (graceful) {
  6. tmp.setGracefulCleanup();
  7. }
  8. try {
  9. var result = spawn.tmpFunction();
  10. spawn.out(result.name, function () {
  11. throw new Error('Thrown on purpose');
  12. });
  13. }
  14. catch (e) {
  15. spawn.err(e, spawn.exit);
  16. }