|
Hi zach.snow,
Thanks for the report. Your code reproduces the error for me too, but after digging into it I think it's misdiagnosed – the real issue is that the runMongoProgram is exiting before the output from the forked process is fully written to the buffer. This script should work assuming the forked PID's are the same length (which they are on my machine ), but it fails even faster:
var text = "";
|
for (var i = 1; i <= 10; i++) {
|
text += "Test line #" + i + "\n";
|
}
|
|
var exitCode = runMongoProgram("echo", text);
|
assert.eq(0, exitCode);
|
var expectedLen = rawMongoProgramOutput().split('\n').length;
|
clearRawMongoProgramOutput();
|
|
var startTime = new Date();
|
for (i = 1; i < 100000; i++) {
|
var exitCode = runMongoProgram("echo", text);
|
assert.eq(0, exitCode);
|
var outputText = rawMongoProgramOutput();
|
assert.neq("", outputText, "got an exit code but there's no output");
|
assert.eq(expectedLen, outputText.split('\n').length, "program exited before done writing to buffer");
|
clearRawMongoProgramOutput();
|
}
|
|