P
P
Pavel Kulaga2020-02-04 17:43:23
C++ / C#
Pavel Kulaga, 2020-02-04 17:43:23

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

1 answer(s)
P
Pavel Kulaga, 2020-02-04
@hapr-lera

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 question

Ask a Question

731 491 924 answers to any question