aboutsummaryrefslogtreecommitdiffstats
path: root/RPCTests/modules/startnode.js
blob: f0877b065b67e0e4f47e9420f0ce3eee8ae5e190 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function startNode (nodeExec, dataDir, genesisPath, listeningPort) 
{
  var spawn = require('child_process').spawn
  var options = [
    '--private', 'privatechain',
    '-d', dataDir,
    '--config', genesisPath,
    '--ipcpath', dataDir + '/geth.ipc',
    '--ipc',
    '--listen', listeningPort,
    '--test'
  ]
  console.log('starting node')
  console.log(nodeExec + ' ' + options.join(' '))
  var node = spawn(nodeExec, options)
  node.stdout.on('data', (data) => {
    console.log(`stdout: ${data}`)
  })
  node.stderr.on('data', (data) => {
    console.log(`stderr: ${data}`)
  })
  node.on('close', (code) => {
    console.log(`child process exited with code ${code}`)
  })
}

module.exports = startNode