forked from ethereum/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findClient.js
43 lines (38 loc) · 852 Bytes
/
findClient.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var which = require('which')
var geth = null
var eth = null
try {
geth = which.sync('geth')
} catch (e) {
}
try {
eth = which.sync('eth')
} catch (e) {
}
if (process.argv.length > 2) {
if (geth && process.argv[2] === 'geth') {
runGeth()
} else if (eth && process.argv[2] === 'eth') {
runEth()
}
} else if (geth && eth) {
console.log('both eth and geth has been found in your system')
console.log('restart the command with the desired client:')
console.log('npm run start_eth')
console.log('or')
console.log('npm run start_geth')
} else if (geth) {
runGeth()
} else if (eth) {
runEth()
} else {
console.log('neither eth or geth has been found in your system')
}
function runEth () {
console.log('starting eth...')
process.exit(20)
}
function runGeth () {
console.log('starting geth...')
process.exit(21)
}