karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [karaf] branch master updated: [KARAF-5778] NPE in the ssh client if TERM is null
Date Wed, 06 Jun 2018 11:08:53 GMT
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b6a673  [KARAF-5778] NPE in the ssh client if TERM is null
0b6a673 is described below

commit 0b6a6736cb461f098e9d59f1986e25e2a480c460
Author: Guillaume Nodet <gnodet@gmail.com>
AuthorDate: Wed Jun 6 13:08:25 2018 +0200

    [KARAF-5778] NPE in the ssh client if TERM is null
---
 client/src/main/java/org/apache/karaf/client/Main.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/client/src/main/java/org/apache/karaf/client/Main.java b/client/src/main/java/org/apache/karaf/client/Main.java
index 987516c..3e90b1a 100644
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -51,8 +51,6 @@ import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.channel.PtyCapableChannelSession;
 import org.apache.sshd.client.future.ConnectFuture;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.channel.PtyMode;
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
@@ -178,8 +176,16 @@ public class Main {
             session.auth().verify();
 
             int exitStatus = 0;
+            String type = System.getProperty(TerminalBuilder.PROP_TYPE);
+            if (type == null) {
+                type = System.getenv("TERM");
+            }
+            if (type == null) {
+                type = Terminal.TYPE_DUMB;
+            }
             try (Terminal terminal = TerminalBuilder.builder()
                         .nativeSignals(true)
+                        .type(type)
                         .signalHandler(Terminal.SignalHandler.SIG_IGN)
                         .build()) {
                 if (config.getCommand().length() > 0) {

-- 
To stop receiving notification emails like this one, please contact
gnodet@apache.org.

Mime
View raw message