8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62d8a8c commit 617eed2Copy full SHA for 617eed2
lib/helper.js
@@ -165,9 +165,19 @@ h.readStdin = function(cb) {
165
var stdin = process.stdin;
166
var bufs = [];
167
168
+ console.log('NOTE: to finish the input, press ' +
169
+ (this.isWindows() ? '<Ctrl-D> and <Return>' : '<Ctrl-D>'));
170
+
171
stdin.on('readable', function() {
172
var data = stdin.read();
- if (data) bufs.push(data);
173
+ if (data) {
174
+ // windows doesn't treat ctrl-D as EOF
175
+ if (h.isWindows() && data.toString() === '\x04\r\n') {
176
+ stdin.emit('end');
177
+ } else {
178
+ bufs.push(data);
179
+ }
180
181
});
182
stdin.on('end', function() {
183
cb(null, Buffer.concat(bufs).toString());
0 commit comments