Answer the question
In order to leave comments, you need to log in
When stopping a child process with ctrl + Z, the main process skips one click, what can be done about it?
I'm working through non-canonical mode.
But when cat is paused with ctrl + Z, my shell skips any single keystroke.
Flags for switching to non-canonical mode:
~(ICANON | ECHO | ISIG);
Before calls, I restore the previous value, and then
waitpid(pid, &stat_loc, WUNTRACED) != -1
turn on non-canonical mode again, maybe someone knows why I have this problem?
Answer the question
In order to leave comments, you need to log in
I found a solution, I'm not sure if it's normal ...
When you stop a child process, you need to limit it in time and then, and after the first successful reading, you can restore it to the default.
tty.c_cc[VMIN] = 0;
tty.c_cc[VTIME] = 1;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question