Comparing version 1.0.3 to 1.0.4
@@ -26,3 +26,9 @@ | ||
var rlOpts = { input: input, output: output, terminal: terminal } | ||
var rl = readline.createInterface(rlOpts) | ||
if (process.version.match(/^v0\.6/)) { | ||
var rl = readline.createInterface(rlOpts.input, rlOpts.output) | ||
} else { | ||
var rl = readline.createInterface(rlOpts) | ||
} | ||
var prompt = (opts.prompt || '').trim() + ' ' | ||
@@ -73,2 +79,9 @@ var silent = opts.silent | ||
rl.close() | ||
if (process.version.match(/^v0\.6/)) { | ||
rl.input.removeAllListeners('data') | ||
rl.input.removeAllListeners('keypress') | ||
rl.input.pause() | ||
} | ||
clearTimeout(timer) | ||
@@ -75,0 +88,0 @@ output.mute() |
{ | ||
"name": "read", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "lib/read.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -36,4 +36,19 @@ ## read | ||
## COMPATIBILITY | ||
This module works sort of with node 0.6. It does not work with node | ||
versions less than 0.6. It is best on node 0.8. | ||
On node version 0.6, it will remove all listeners on the input | ||
stream's `data` and `keypress` events, because the readline module did | ||
not fully clean up after itself in that version of node, and did not | ||
make it possible to clean up after it in a way that has no potential | ||
for side effects. | ||
Additionally, some of the readline options (like `terminal`) will not | ||
function in versions of node before 0.8, because they were not | ||
implemented in the builtin readline module. | ||
## CONTRIBUTING | ||
Patches welcome. |
@@ -8,2 +8,7 @@ var tap = require('tap') | ||
var CLOSE = 'close' | ||
if (process.version.match(/^v0\.6/)) { | ||
CLOSE = 'exit' | ||
} | ||
var spawn = require('child_process').spawn | ||
@@ -35,3 +40,3 @@ | ||
child.on('close', function () { | ||
child.on(CLOSE, function () { | ||
result = JSON.parse(result) | ||
@@ -38,0 +43,0 @@ t.same(result, {"user":"a user","pass":"a password","verify":"a password","passMatch":true}) |
@@ -8,2 +8,7 @@ var tap = require('tap') | ||
var CLOSE = 'close' | ||
if (process.version.match(/^v0\.6/)) { | ||
CLOSE = 'exit' | ||
} | ||
var spawn = require('child_process').spawn | ||
@@ -35,3 +40,3 @@ | ||
child.on('close', function () { | ||
child.on(CLOSE, function () { | ||
result = JSON.parse(result) | ||
@@ -38,0 +43,0 @@ t.same(result, {"user":"test-user","pass":"test-pass","verify":"test-pass","passMatch":true}) |
var tap = require('tap') | ||
var read = require('../lib/read.js') | ||
var CLOSE = 'close' | ||
if (process.version.match(/^v0\.6/)) { | ||
CLOSE = 'exit' | ||
} | ||
if (process.argv[2] === 'child') { | ||
@@ -71,3 +76,3 @@ return child() | ||
}) | ||
child.on('close', function (c) { | ||
child.on(CLOSE, function (c) { | ||
t.equal(output, expect) | ||
@@ -74,0 +79,0 @@ t.equal(n, 19) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
12532
286
54
0