aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tmp/test/graceful-sync.js
blob: 37766ffa61b430d76721d103dcb35511cc04ffe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var
  tmp = require('../lib/tmp'),
  spawn = require('./spawn-sync');

var graceful = spawn.arg;

if (graceful) {
  tmp.setGracefulCleanup();
}

try {
  var result = spawn.tmpFunction();
  spawn.out(result.name, function () {
    throw new Error('Thrown on purpose');
  });
}
catch (e) {
  spawn.err(e, spawn.exit);
}