Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: fix testcase to actually detect regression
In order for the testcase to fail, the calls to read() must be done
after 'exit' is emitted and after flushStdio has been called.

With this change, the testcase will catch any regressions on this
issue.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
  • Loading branch information
petrosagg committed Jun 7, 2016
commit f179bb6687ab0aee3fd681836f46ef8ac6b0a4c6
8 changes: 5 additions & 3 deletions test/parallel/test-child-process-flush-stdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ function spawnWithReadable() {
spawnWithPipe();
}));
p.stdout.on('readable', function() {
let buf;
while (buf = this.read())
buffer.push(buf);
setImmediate(() => {
let buf;
while (buf = this.read())
buffer.push(buf);
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change necessary?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This testcase was added to cover the issue fixed here: balena-io-experimental@12274a5

But the testcase passes even if the change of that commit is reverted. So I just fixed the testcase to reflect what was actually fixed there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will PR this separately

Copy link
Copy Markdown
Member

@addaleax addaleax Jun 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrosagg Can confirm that this test case worked even before 12274a5 – nice catch! A separate PR seems like a good idea, yep

});
}

Expand Down