Completed
Push — master ( c8cc0a...f17656 )
by Thomas
44s
created

lib/util/ChildProcess.js   A

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 23
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 1
b 0
f 0
nc 1
mnd 1
bc 4
fnc 4
dl 0
loc 23
rs 10
bpm 1
cpm 1.25
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ChildProcess.js ➔ runProcess 0 14 1
1
'use strict'
2
3
const output = require('../output')
4
const childProcess = require('child_process')
5
6
function runProcess (script) {
7
  var process = childProcess.exec(script)
8
  output.logComponent('Script', 'blue', 'Executing "' + script + '"')
9
  process.on('exit', function (code) {
10
    code = parseInt(code, 10) || code
11
    output.logComponent('Script', code === 0 ? 'blue' : 'red', 'Exited with code ' + code)
12
  })
13
  process.stderr.on('data', function (message) {
14
    output.logComponent('Script', 'red', message)
15
  })
16
  process.stdout.on('data', function (message) {
17
    output.logComponent('Script', 'blue', message)
18
  })
19
}
20
21
module.exports = {
22
  run: runProcess
23
}
24