コード例 #1
0
ファイル: JschSshClient.java プロジェクト: raphsoft/che
 @Override
 public JschSshProcess createProcess(String commandLine) throws MachineException {
   try {
     ChannelExec exec = (ChannelExec) session.openChannel("exec");
     exec.setCommand(commandLine);
     envVars
         .entrySet()
         .stream()
         .forEach(
             envVariableEntry ->
                 exec.setEnv(envVariableEntry.getKey(), envVariableEntry.getValue()));
     return new JschSshProcess(exec);
   } catch (JSchException e) {
     throw new MachineException(
         "Can't establish connection to perform command execution in ssh machine. Error: "
             + e.getLocalizedMessage(),
         e);
   }
 }