mirror of https://github.com/lukechilds/node.git
Browse Source
test-tty-wrap hasn’t worked since StreamBase was introduced, I think. test-tty-stdout-end also happens to works with PipeWrap-s. Refs: https://github.com/nodejs/node/pull/7360 PR-URL: https://github.com/nodejs/node/pull/7613 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>v4.x
Jeremiah Senkpiel
9 years ago
committed by
Myles Borins
4 changed files with 9 additions and 25 deletions
@ -1,28 +1,11 @@ |
|||||
'use strict'; |
'use strict'; |
||||
const common = require('../common'); |
require('../common'); |
||||
var assert = require('assert'); |
|
||||
|
|
||||
var TTY = process.binding('tty_wrap').TTY; |
const TTY = process.binding('tty_wrap').TTY; |
||||
var isTTY = process.binding('tty_wrap').isTTY; |
const WriteWrap = process.binding('stream_wrap').WriteWrap; |
||||
|
|
||||
if (isTTY(1) == false) { |
const handle = new TTY(1); |
||||
common.skip('fd 1 is not a tty.'); |
const req = new WriteWrap(); |
||||
return; |
|
||||
} |
|
||||
|
|
||||
var handle = new TTY(1); |
handle.writeBuffer(req, Buffer.from('hello world 1\n')); |
||||
var callbacks = 0; |
handle.writeBuffer(req, Buffer.from('hello world 2\n')); |
||||
|
|
||||
var req1 = handle.writeBuffer(Buffer('hello world\n')); |
|
||||
req1.oncomplete = function() { |
|
||||
callbacks++; |
|
||||
}; |
|
||||
|
|
||||
var req2 = handle.writeBuffer(Buffer('hello world\n')); |
|
||||
req2.oncomplete = function() { |
|
||||
callbacks++; |
|
||||
}; |
|
||||
|
|
||||
process.on('exit', function() { |
|
||||
assert.equal(2, callbacks); |
|
||||
}); |
|
||||
|
@ -0,0 +1,2 @@ |
|||||
|
hello world 1 |
||||
|
hello world 2 |
Loading…
Reference in new issue