Fix EPERM on Windows and fix Tournament freeze with agent timeout #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tournament freeze on Timeout
If an agent timeout in a tournament, then its process is killed before the end of the match.
When
Agent._terminate()is called, the process doesn't exist (this.processis never set to null).So the promise is never solved and the tournament is stuck.
EPERM on Windows
If the two agents of a match never write to stderr, then
Match.handleLogFiles()tries to remove the folder.However, this will fail on Windows because errorLogWriteStream is never closed.
Since data can still be sent by the process after close,
errorLogWriteStreamstatus must be checked.Patch for the npm packages
I don't expect this PR to be merged.
However, here is a patch for anyone in need.