2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2015-12-23 16:02:12 -08:00
|
|
|
require('../common');
|
2011-09-20 13:38:07 -07:00
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var TTY = process.binding('tty_wrap').TTY;
|
|
|
|
var isTTY = process.binding('tty_wrap').isTTY;
|
|
|
|
|
|
|
|
if (isTTY(1) == false) {
|
2015-07-06 03:24:12 +00:00
|
|
|
console.log('1..0 # Skipped: fd 1 is not a tty.');
|
2015-07-07 20:55:55 +05:30
|
|
|
return;
|
2011-09-20 13:38:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var handle = new TTY(1);
|
|
|
|
var callbacks = 0;
|
|
|
|
|
2016-01-25 15:00:06 -08:00
|
|
|
var req1 = handle.writeBuffer(Buffer.from('hello world\n'));
|
2011-09-20 13:38:07 -07:00
|
|
|
req1.oncomplete = function() {
|
|
|
|
callbacks++;
|
|
|
|
};
|
|
|
|
|
2016-01-25 15:00:06 -08:00
|
|
|
var req2 = handle.writeBuffer(Buffer.from('hello world\n'));
|
2011-09-20 13:38:07 -07:00
|
|
|
req2.oncomplete = function() {
|
|
|
|
callbacks++;
|
|
|
|
};
|
|
|
|
|
|
|
|
process.on('exit', function() {
|
|
|
|
assert.equal(2, callbacks);
|
|
|
|
});
|