Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all stream buffers are drained before exiting process in single run mode. #742

Open
kdrvn opened this issue Sep 11, 2013 · 3 comments

Comments

@kdrvn
Copy link

kdrvn commented Sep 11, 2013

After investigating a strange behavior on running karma with TeamCity on Windows, I noticed the following issue.

When running the following command in PowerShell:

karma start --single-run | Out-File C:\test.out

The writing function is non-blocking/asynchronous & the written/piped data can be buffered, which could lead to some test results being lost.

Karma needs to ensure that all buffers have been drained or that the writing functions have completed (if they are non-blocking) before exiting the process.

@vojtajina
Copy link
Contributor

Yep, I think we should use https://npmjs.org/package/exit

@DanTup
Copy link
Contributor

DanTup commented Apr 9, 2014

I had the same issue in my Jasmine VS extension, and I fixed it in a much simpler way than what that module seems to do:

process.stdout.once('drain', function() {
    process.exit();
});

Not sure whether I've missed something; but this seems much simpler?

@vojtajina
Copy link
Contributor

@DanTup yep we could do this. Actually, I just realized we might use the "exit" event (

globalEmitter.emitAsync('exit').then(function() {
) which is used by all the components in the system to delay exit (eg. reporters writing a file). In the same way, we should wait for process.stdout to drain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants