blob: 1cd014992dcad64fd3c28ef71b1d3375ede117ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
var common = require('../common');
var assert = require('assert');
var TTY = process.binding('tty_wrap').TTY;
var isTTY = process.binding('tty_wrap').isTTY;
if (isTTY(1) == false) {
console.error('fd 1 is not a tty. skipping test.');
process.exit(0);
}
var handle = new TTY(1);
var callbacks = 0;
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);
});
|