| Conditions | 3 |
| Paths | 5 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import process from 'child_process' |
||
| 10 | export function create(name) { |
||
| 11 | let lockFile = path.join(config.root, `abe-process-${name}.lock`) |
||
| 12 | try { |
||
| 13 | var stats = fs.statSync(lockFile) |
||
| 14 | if (stats.isFile()) { |
||
| 15 | console.log(`cannot lock process ${name} already running`) |
||
| 16 | return false |
||
| 17 | } |
||
| 18 | }catch(err) { |
||
| 19 | fs.writeFileSync(lockFile, '', {encoding: 'utf8'}) |
||
| 20 | } |
||
| 21 | |||
| 22 | return true |
||
| 23 | } |
||
| 24 | |||
| 46 | } |