public void close() { if (term != null) { term.close(); } else { jobController.close(ar -> closedFuture.complete()); } }
public ShellImpl init() { term.interruptHandler(key -> jobController().foregroundJob().interrupt()); term.suspendHandler( key -> { term.echo(Helper.fromCodePoints(new int[] {key, '\n'})); Job job = jobController.foregroundJob(); term.echo(statusLine(job, ExecStatus.STOPPED) + "\n"); job.suspend(); return true; }); term.closeHandler(v -> jobController.close(ar -> closedFuture.complete())); if (welcome != null && welcome.length() > 0) { term.write(welcome); } return this; }