(message)
| 65 | } |
| 66 | |
| 67 | function writeToFile(message) { |
| 68 | if (fd === undefined) { |
| 69 | fs = require('fs'); |
| 70 | try { |
| 71 | fd = fs.openSync(warningFile, 'a'); |
| 72 | } catch { |
| 73 | return writeOut(message); |
| 74 | } |
| 75 | process.on('exit', closeFdOnExit); |
| 76 | } |
| 77 | fs.appendFile(fd, `${message}\n`, (err) => { |
| 78 | if (err) { |
| 79 | writeOut(message); |
| 80 | } |
| 81 | }); |
| 82 | } |
| 83 | |
| 84 | function doEmitWarning(warning) { |
| 85 | process.emit('warning', warning); |