Skip to content

Commit

Permalink
fix(tests): guarded func to avoid it being called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Sep 16, 2016
1 parent e0dc296 commit 2c8a3c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ module.exports = class Node {
.on('data', onData)

// done2 is called to call done after removing the event listeners
function done2 (err, val) {
let done2 = (err, val) => {
node.subprocess.removeListener('data', onData)
node.subprocess.removeListener('error', onErr)
if (err) {
node.killProcess(() => {}) // we failed. kill, just to be sure...
}
done(err, val)
done = () => {} // in case it gets called twice
done2 = () => {} // in case it gets called twice
}

function onErr (err) {
Expand Down
2 changes: 1 addition & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ describe('ipfs-api version', function () {

const added = res[res.length - 1]
assert(added)
assert.equal(added.hash, 'QmatJh68V8sNqHujiJe9Bbz9jwaM4TFiER9qqWtFoyBKic')
assert.equal(added.hash, 'QmUNYnr4nm9Zfr6utTD9rVdSf9ASRguqHDciwvsc2gsH8y')
done()
})
})
Expand Down

0 comments on commit 2c8a3c1

Please sign in to comment.