Skip to content

Commit 69b7335

Browse files
gnodetstbischof
authored andcommitted
Make Pipe.setCurrentPipe public to fix interruption handling in nested shells
This change makes the setCurrentPipe method in the Pipe class public to allow proper handling of interruption signals in nested shells. This is needed to fix an issue in JLine where Ctrl+C doesn't properly interrupt commands running in a nested shell. The issue occurs when a user starts a shell session, then runs the 'sh' command to create a nested shell, and then runs a command like 'ttop' in that nested shell. When the user presses Ctrl+C to interrupt the 'ttop' command, the interruption signal is caught by the parent shell but not properly propagated to the child shell. By making setCurrentPipe public, we allow the nested shell to clear the current pipe before creating a child shell and restore it afterward, ensuring that interruption signals are properly propagated. See: jline/jline3#1143
1 parent d95c1ae commit 69b7335

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • gogo/runtime/src/main/java/org/apache/felix/gogo/runtime

gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ public static Pipe getCurrentPipe() {
107107
return CURRENT.get();
108108
}
109109

110-
private static Pipe setCurrentPipe(Pipe pipe) {
110+
/**
111+
* Set the current pipe for the current thread.
112+
* @param pipe the pipe to set as current, or null to clear
113+
* @return the previous pipe
114+
*/
115+
public static Pipe setCurrentPipe(Pipe pipe) {
111116
Pipe previous = CURRENT.get();
112117
CURRENT.set(pipe);
113118
return previous;

0 commit comments

Comments
 (0)