-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hanging terminal when unexpected runtime exception occurs
- Loading branch information
François Onimus
committed
Oct 18, 2019
1 parent
09e1ab0
commit b3bb41d
Showing
7 changed files
with
343 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 28 additions & 24 deletions
52
starter/src/main/java/com/github/fonimus/ssh/shell/SshContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,48 @@ | ||
package com.github.fonimus.ssh.shell; | ||
|
||
import com.github.fonimus.ssh.shell.auth.SshAuthentication; | ||
import com.github.fonimus.ssh.shell.postprocess.PostProcessorObject; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
import org.jline.reader.LineReader; | ||
import org.jline.terminal.Terminal; | ||
|
||
import java.util.List; | ||
import com.github.fonimus.ssh.shell.auth.SshAuthentication; | ||
import com.github.fonimus.ssh.shell.postprocess.PostProcessorObject; | ||
|
||
/** | ||
* Ssh context to hold terminal, exit callback and thread per thread | ||
*/ | ||
@Getter | ||
public class SshContext { | ||
|
||
private Thread thread; | ||
private SshShellRunnable sshShellRunnable; | ||
|
||
private Terminal terminal; | ||
|
||
private Terminal terminal; | ||
private LineReader lineReader; | ||
|
||
private LineReader lineReader; | ||
private SshAuthentication authentication; | ||
|
||
private SshAuthentication authentication; | ||
@Setter | ||
private List<PostProcessorObject> postProcessorsList; | ||
|
||
@Setter | ||
private List<PostProcessorObject> postProcessorsList; | ||
public SshContext() { | ||
} | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param thread ssh thread session | ||
* @param terminal ssh terminal | ||
* @param lineReader ssh line reader | ||
* @param authentication (optional) spring authentication objects | ||
*/ | ||
public SshContext(Thread thread, Terminal terminal, LineReader lineReader, | ||
SshAuthentication authentication) { | ||
this.thread = thread; | ||
this.terminal = terminal; | ||
this.lineReader = lineReader; | ||
this.authentication = authentication; | ||
} | ||
/** | ||
* Constructor | ||
* | ||
* @param sshShellRunnable | ||
* @param terminal ssh terminal | ||
* @param lineReader ssh line reader | ||
* @param authentication (optional) spring authentication objects | ||
*/ | ||
public SshContext(SshShellRunnable sshShellRunnable, Terminal terminal, LineReader lineReader, SshAuthentication authentication) { | ||
this.sshShellRunnable = sshShellRunnable; | ||
this.terminal = terminal; | ||
this.lineReader = lineReader; | ||
this.authentication = authentication; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
starter/src/main/java/com/github/fonimus/ssh/shell/SshIO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) Worldline 2019. | ||
*/ | ||
|
||
package com.github.fonimus.ssh.shell; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
import org.apache.sshd.server.ExitCallback; | ||
|
||
/** | ||
* Ssh io | ||
*/ | ||
@Getter | ||
@Setter | ||
public class SshIO { | ||
|
||
private InputStream is; | ||
|
||
private OutputStream os; | ||
|
||
private ExitCallback ec; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.