-
Notifications
You must be signed in to change notification settings - Fork 52
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
unreliable proc.on('close') event #419
Labels
Comments
patch to demo the issue, from #418 diff --git a/packages/neovim/src/attach/attach.test.ts b/packages/neovim/src/attach/attach.test.ts
index 70d16597..4f0c6942 100644
--- a/packages/neovim/src/attach/attach.test.ts
+++ b/packages/neovim/src/attach/attach.test.ts
@@ -154,14 +154,38 @@ describe('Nvim API', () => {
expect(newLines).toEqual(['line1', 'line2']);
});
- it('emits "disconnect" after quit', done => {
+ it.only('emits "disconnect" after quit', done => {
const disconnectMock = jest.fn();
nvim.on('disconnect', disconnectMock);
nvim.quit();
+ const r = {
+ stdoutClosed: false,
+ stderrClosed: false,
+ errors: 0,
+ };
+ proc.stdout.on('close', () => {
+ r.stdoutClosed = true;
+ });
+ proc.stderr.on('close', () => {
+ r.stderrClosed = true;
+ });
+ proc.on('error', () => {
+ r.errors = r.errors + 1;
+ });
+
// TODO: 'close' event sometimes does not emit. #414
proc.on('exit', () => {
+ expect(r).toStrictEqual({
+ stdoutClosed: true,
+ stderrClosed: true,
+ errors: 0,
+ });
+ done();
+ });
+
+ proc.on('close', () => {
expect(disconnectMock).toHaveBeenCalledTimes(1);
done();
}); |
This comment has been minimized.
This comment has been minimized.
any issue that is still open is up for contribution. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a tracking issue for a potential issue noticed in #414 (comment)
Problem
proc.on('close')
does not always trigger onnvim.quit()
. Based on the failures demonstrated in #418, it appears that sometimes the child (nvim
) does not close the stderr pipe:Solution
proc.on('close')
is unreliable.proc.on('exit')
as a workaround.fclose(stderr)
does not pass the tests in this PR. Nor does addingfclose(stderr)
anywhere else AFAICT.The text was updated successfully, but these errors were encountered: