From ba42efe6f5bc62477a31607622d23f8329261b9f Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 9 Jul 2015 12:50:09 -0400 Subject: [PATCH 1/2] Dynamic bitcoindjs.node loading. --- lib/bitcoind.js | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bitcoind.js b/lib/bitcoind.js index 9557412e..75a326d1 100644 --- a/lib/bitcoind.js +++ b/lib/bitcoind.js @@ -6,7 +6,7 @@ var net = require('net'); var EventEmitter = require('events').EventEmitter; -var bitcoindjs = require('../build/Debug/bitcoindjs.node'); +var bitcoindjs = require('bindings')('bitcoindjs.node'); var util = require('util'); var fs = require('fs'); var mkdirp = require('mkdirp'); diff --git a/package.json b/package.json index 07dbb107..50577145 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,9 @@ "bitcoind" ], "dependencies": { - "nan": "1.3.0", + "bindings": "^1.2.1", "mkdirp": "0.5.0", + "nan": "1.3.0", "tiny": "0.0.10" }, "devDependencies": { From b1aac020789fdb8cd9ccccedd66cd4b48050b75a Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 9 Jul 2015 12:55:53 -0400 Subject: [PATCH 2/2] Fix example and formatting issue. --- example/index.js | 5 +++-- lib/bitcoind.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example/index.js b/example/index.js index 3ee211c7..b1db8701 100755 --- a/example/index.js +++ b/example/index.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +'use strict'; + /** * bitcoind.js example */ @@ -9,10 +11,9 @@ process.title = 'bitcoind.js'; /** * bitcoind */ -var bitcoindjsConf = process.env('BITCOINDJS_DIR'); var bitcoind = require('../')({ - directory: '~/.libbitcoind-example' + directory: process.env.BITCOINDJS_DIR || '~/.bitcoin' }); bitcoind.on('error', function(err) { diff --git a/lib/bitcoind.js b/lib/bitcoind.js index 9430d81e..ce32f74d 100644 --- a/lib/bitcoind.js +++ b/lib/bitcoind.js @@ -196,7 +196,8 @@ Bitcoin.prototype.start = function(options, callback) { bitcoindjs.start(options, function(err, status) { self._started = true; - // Poll for queued packet [sigint, sighup, sigquit].forEach(function(signal) { + // Poll for queued packet + [sigint, sighup, sigquit].forEach(function(signal) { process.on(signal.name, signal.listener = function() { if (process.listeners(signal.name).length > 1) { return;