test/fixtures/compromised.js
raw| 1 | 'use strict'; |
| 2 | |
| 3 | const fs = require('fs'); |
| 4 | const lockfile = require('../..'); |
| 5 | |
| 6 | const tmpDir = `${__dirname}/../tmp`; |
| 7 | |
| 8 | fs.writeFileSync(`${tmpDir}/foo`, ''); |
| 9 | |
| 10 | lockfile.lockSync(`${tmpDir}/foo`, { update: 1000 }); |
| 11 | |
| 12 | fs.rmdirSync(`${tmpDir}/foo.lock`); |
| 13 | |
| 14 | // Do not let the process exit |
| 15 | setInterval(() => {}, 1000); |
| 16 | |
| 17 | process.on('uncaughtException', (err) => { |
| 18 | err.code && process.stderr.write(`${err.code}\n\n`); |
| 19 | throw err; |
| 20 | }); |