You you send a SIGSTOP to a process, the stty of parent process is used.
So on a SIGCONT, you have to performs again your stty modifications.
You find below a working code, which handle stop and continue with sun.misc (restricted access) methods.
----- In ConsoleReader.java
public void manageInterruption() {
Signal.handle(new Signal("CONT"), new SignalHandler() {
public void handle(final Signal sig) {
((UnixTerminal) terminal).continueSignal();
try {
drawLine();
flush();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
public ConsoleReader(final InputStream in, final Writer out, final InputStream bindings, final Terminal term)
throws IOException {
this.in = in;
this.out = out;
this.terminal = term != null ? term : TerminalFactory.get();
if (terminal instanceof UnixTerminal) {
manageInterruption();
}
...
----- In UnixTerminal.java
public void continueSignal() {
// set the console to be character-buffered instead of line-buffered
try {
settings.set("-icanon min 1");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
setEchoEnabled(false);
}