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

vicc stops when the window size is changed #95

Closed
yoe opened this issue Mar 29, 2017 · 5 comments
Closed

vicc stops when the window size is changed #95

yoe opened this issue Mar 29, 2017 · 5 comments

Comments

@yoe
Copy link

yoe commented Mar 29, 2017

Expected behaviour

start vicc with various arguments in a terminal
resize the terminal
everything continues working as before

Actual behaviour

vicc exits

Steps to reproduce

  1. start vicc in a terminal window
  2. resize the window

Logs

N/A

@frankmorgner
Copy link
Owner

interesting... what terminal are you using?

@yoe
Copy link
Author

yoe commented Mar 31, 2017

I use urxvt (packaged in Debian as rxvt-unicode)

@frankmorgner
Copy link
Owner

Could you check whether #96 fixes the problem?

@yoe
Copy link
Author

yoe commented Apr 3, 2017

Nope, it doesn't.

Had a closer look, though. When running vicc in strace, it has this to say:

recvfrom(3, 0x7f7a91507f7c, 2, 0, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
close(3)                                = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f7a9a4f00c0}, {sa_handler=0x55b34095ae60, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f7a9a4f00c0}, 8) = 0

... so the problem is that when a signal arrives and the system call is therefore cancelled, that condition isn't handled, and the program is ended rather than the recv() restarted.

I'm not that well versed in python, but if I check the docs, you should be able to figure this out by doing

import ctypes
import errno
recv(...)
if ctypes.get_errno() == errno.EINTR:
    # retry the recv
else:
   # handle error

probably using some loop etc.

I'll see if I can test that theory later this week, will try to whip up a patch.

@frankmorgner
Copy link
Owner

never mind, I fixed this already 😉

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

Successfully merging a pull request may close this issue.

2 participants