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

bepFileHandle will leak resource when catch a parse error #9

Open
Kila2 opened this issue Nov 4, 2022 · 1 comment
Open

bepFileHandle will leak resource when catch a parse error #9

Kila2 opened this issue Nov 4, 2022 · 1 comment

Comments

@Kila2
Copy link
Contributor

Kila2 commented Nov 4, 2022

while input.hasBytesAvailable {
do {
let event = try BinaryDelimited.parse(messageType: BuildEventStream_BuildEvent.self, from: input)
logger.trace("Received BEP event: \(event)")
bepHandler(event)
if event.lastMessage {
logger.trace("Received last BEP event")
bepFileHandle.closeFile()
bepFileHandle.readabilityHandler = nil
}
} catch {
logger.error("Failed to parse BEP event: \(error)")
return
}
}
}
}

@brentleyjones
Copy link
Contributor

Please open a PR if you know the fix! I'm a bit busy right now, so it will be difficult for me to make the change myself, but I can review and merge PRs.

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

No branches or pull requests

2 participants