Commit a353dd69 authored by yann300's avatar yann300

startnode script

parent f9c1c94a
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)
}
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'config', 'get', 'prefix' ]
2 info using npm@3.8.6
3 info using node@v5.12.0
4 verbose exit [ 0, true ]
5 verbose stack Error: write EPIPE
5 verbose stack at exports._errnoException (util.js:893:11)
5 verbose stack at WriteWrap.afterWrite (net.js:783:14)
6 verbose cwd /home/yann/Ethereum/remix/fea1/remix
7 error Linux 3.16.0-30-generic
8 error argv "/usr/bin/nodejs" "/usr/bin/npm" "config" "get" "prefix"
9 error node v5.12.0
10 error npm v3.8.6
11 error code EPIPE
12 error errno EPIPE
13 error syscall write
14 error write EPIPE
15 error If you need help, you may report this error at:
15 error <https://github.com/npm/npm/issues>
16 verbose exit [ 1, true ]
......@@ -13,6 +13,9 @@
}
],
"main": "./src/index.js",
"dependencies": {
"which": "^1.2.10"
},
"devDependencies": {
"browserify": "^13.0.1",
"ethereumjs-util": "^4.5.0",
......@@ -26,7 +29,9 @@
"yo-yoify": "^3.1.0"
},
"scripts": {
"start_node": "eth --rpccorsdomain \"*\" -j -v 0",
"start_node": "./runNode.sh",
"start_eth": "eth -j --rpccorsdomain '*'",
"start_geth": "geth --rpc --rpcapi 'web3,eth,debug' --rpcport 8545 --rpccorsdomain '*'",
"build": "mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js",
"test": "standard && tape ./test/tests.js",
"serve": "http-server .",
......
#!/usr/bin/env bash
node findClient.js $1
RUNCLIENT=$?
if [ $RUNCLIENT -eq '20' ]
then
npm run start_eth
fi
if [ $RUNCLIENT -eq '21' ]
then
echo $?
npm run start_geth
fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment