Comparing version
16
index.js
@@ -14,7 +14,7 @@ /** | ||
if (null === obj || "object" !== typeof obj) return obj; | ||
var copy = obj.constructor(); | ||
var cc = obj.constructor(); | ||
for (var attr in obj) { | ||
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; | ||
if (obj.hasOwnProperty(attr)) cc[attr] = obj[attr]; | ||
} | ||
return copy; | ||
return cc; | ||
} | ||
@@ -134,4 +134,4 @@ | ||
this.trigger = trigger || noop; | ||
process._events.removeListener("exit"); | ||
if (!this.persist) { | ||
process._events.removeListener("exit"); | ||
process.on("exit", function () { | ||
@@ -157,3 +157,2 @@ if (self.proc !== null) self.stop(); | ||
if (code !== 2 && code !== 0) { | ||
self.stop(); | ||
self.trigger(new Error("geth closed with code " + code)); | ||
@@ -166,3 +165,3 @@ } | ||
this.proc.stderr.on("data", listeners.stderr); | ||
this.proc.on("close", listeners.close); | ||
this.proc._events.close = listeners.close; | ||
return this.proc; | ||
@@ -177,6 +176,9 @@ } | ||
if (this.proc) { | ||
this.proc._events.close = function (code) { | ||
var closed = function (code) { | ||
self.configured = false; | ||
self.proc._events.close = null; | ||
self.proc = null; | ||
callback(null, code); | ||
}; | ||
this.proc.on("close", closed); | ||
this.proc.kill("SIGINT"); | ||
@@ -183,0 +185,0 @@ } else { |
{ | ||
"name": "geth", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Start and stop geth from Node.js", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/tinybike/geth.js.git" | ||
"url": "git+https://github.com/AugurProject/geth.js.git" | ||
}, | ||
@@ -24,5 +24,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/tinybike/geth.js/issues" | ||
"url": "https://github.com/AugurProject/geth.js/issues" | ||
}, | ||
"homepage": "https://github.com/tinybike/geth.js#readme", | ||
"homepage": "https://github.com/AugurProject/geth.js#readme", | ||
"devDependencies": { | ||
@@ -29,0 +29,0 @@ "async": "^1.5.0", |
geth.js | ||
======= | ||
[](https://travis-ci.org/tinybike/geth.js) | ||
[](https://coveralls.io/github/tinybike/geth.js?branch=master) | ||
[](https://travis-ci.org/AugurProject/geth.js) | ||
[](https://coveralls.io/github/AugurProject/geth.js?branch=master) | ||
[](https://badge.fury.io/js/geth) | ||
A simple tool to start/stop [geth](https://github.com/ethereum/go-ethereum) from Node.js. | ||
Start and stop [geth](https://github.com/ethereum/go-ethereum) from Node.js. | ||
@@ -23,3 +23,3 @@ Usage | ||
geth accepts a configuration object, which uses the same flags as the geth command line client. (Since this is JavaScript, the flags are organized into an object.) Flags that are not accompanied by a value on the command line (for example, `--mine`) should be passed in as `{ flag: null }`. | ||
geth's `start` method accepts a configuration object, which uses the same flags as the geth command line client. (Here, the flags are organized into an object.) Flags that are not accompanied by a value on the command line (for example, `--mine`) should be passed in as `{ flag: null }`. | ||
```javascript | ||
@@ -26,0 +26,0 @@ var options = { |
10235
0.79%163
1.24%