parent
a695065305
commit
ae1fc497bb
@ -1160,6 +1160,8 @@ int main(int argc, char *argv[]) {
|
|||||||
// so your next reading stop should be node::Load()!
|
// so your next reading stop should be node::Load()!
|
||||||
node::Load(argc, argv);
|
node::Load(argc, argv);
|
||||||
|
|
||||||
|
node::Stdio::Flush();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Clean up.
|
// Clean up.
|
||||||
context.Dispose();
|
context.Dispose();
|
||||||
|
@ -197,6 +197,19 @@ Close (const Arguments& args)
|
|||||||
return Undefined();
|
return Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Stdio::Flush() {
|
||||||
|
if (stdout_fd >= 0) {
|
||||||
|
close(stdout_fd);
|
||||||
|
stdout_fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdout_coupling) {
|
||||||
|
coupling_join(stdout_coupling);
|
||||||
|
coupling_destroy(stdout_coupling);
|
||||||
|
stdout_coupling = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Stdio::Initialize (v8::Handle<v8::Object> target)
|
Stdio::Initialize (v8::Handle<v8::Object> target)
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ namespace node {
|
|||||||
class Stdio {
|
class Stdio {
|
||||||
public:
|
public:
|
||||||
static void Initialize (v8::Handle<v8::Object> target);
|
static void Initialize (v8::Handle<v8::Object> target);
|
||||||
|
static void Flush ();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
@ -8,5 +8,3 @@ for (var i = 0; i < n-1; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
puts(s); // \n is the nth char.
|
puts(s); // \n is the nth char.
|
||||||
|
|
||||||
process.exit(0);
|
|
||||||
|
@ -2,9 +2,8 @@ process.mixin(require("./common"));
|
|||||||
|
|
||||||
var sub = path.join(fixturesDir, 'print-chars.js');
|
var sub = path.join(fixturesDir, 'print-chars.js');
|
||||||
|
|
||||||
completedTests = 0;
|
n = 100000;
|
||||||
|
|
||||||
function test (n, cb) {
|
|
||||||
var child = process.createChildProcess(process.argv[0], [sub, n]);
|
var child = process.createChildProcess(process.argv[0], [sub, n]);
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
@ -19,26 +18,11 @@ function test (n, cb) {
|
|||||||
child.addListener("output", function (data){
|
child.addListener("output", function (data){
|
||||||
if (data) {
|
if (data) {
|
||||||
count += data.length;
|
count += data.length;
|
||||||
|
puts(count);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
child.addListener("exit", function (data) {
|
child.addListener("exit", function (data) {
|
||||||
assert.equal(n, count);
|
assert.equal(n, count);
|
||||||
puts(n + " okay");
|
puts("okay");
|
||||||
completedTests++;
|
|
||||||
if (cb) cb();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test(5000, function () {
|
|
||||||
test(50000, function () {
|
|
||||||
test(500000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
process.addListener('exit', function () {
|
|
||||||
assert.equal(3, completedTests);
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user