private void readStd( Session session ) throws KettleException { InputStream isOut = null; InputStream isErr = null; try { isOut = session.getStdout(); isErr = session.getStderr(); setStdOut( readInputStream( isOut ) ); setStdErr( readInputStream( isErr ) ); } catch ( Exception e ) { throw new KettleException( e ); } finally { try { if ( isOut != null ) { isOut.close(); } if ( isErr != null ) { isErr.close(); } } catch ( Exception e ) { /* Ignore */ } } }
InputStream stderr = sshSession.getStderr();
InputStream stderr = sess.getStderr();
@Override public InputStream getErrorStream() { return s.getStderr(); }
@Override public InputStream getErrorStream() { return ssh.getStderr(); }
public InputStream getErr() { return mySession.getStderr(); }
private void initSession() { try { session = conn.openSession(); session.requestDumbPTY(); session.startShell(); stdoutReader = new BufferedReader(new InputStreamReader( session.getStdout())); stderrReader = new BufferedReader(new InputStreamReader( session.getStderr())); out = new PrintWriter(session.getStdin()); } catch (Exception e) { String msg = "\nOpen SSH2 Session Error !"; logger.error(msg, e); throw new RuntimeException(msg, e); } }
public String execute() throws IOException, InterruptedException { InputStream stdout = session.getStdout(); InputStream stderr = session.getStderr(); char[] buffer = new char[8192]; StringBuilder stringBuilder = new StringBuilder();
public String execute() throws IOException, InterruptedException { InputStream stdout = session.getStdout(); InputStream stderr = session.getStderr(); char[] buffer = new char[2048]; BufferedReader stdoutReader = new BufferedReader(
public RemoteCmdClientStream(Session session, String ip) { if (session != null) { this.session = session; this.ip = ip; this.stdout = new StreamGobbler(session.getStdout()); this.stderr = new StreamGobbler(session.getStderr()); } }
session.execCommand(cmd.getCmd()); stdout = new StreamGobbler(session.getStdout()); stderr = new StreamGobbler(session.getStderr()); br = new BufferedReader(new InputStreamReader(stdout)); errbr = new BufferedReader(new InputStreamReader(stderr));
final InputStream stderr = sshSession.getStderr();
clientDebugDisplayCallable.setCustomPos(customeredOut); customerIn.connect(customeredOut); stderr = new StreamGobbler(session.getStderr()); ClientDebugInputCallable ClientDebugInputCallable = new ClientDebugInputCallable(session, cmds, passWord);
final InputStream stderr = sess.getStderr();
err = new StreamGobbler(sess.getStderr());
stderr = new StreamGobbler(session.getStderr()); if (stderr == null) { throw new CommandException("Could not obtain stderr reader");
/** * Executes a process remotely and blocks until its completion. * * @param command the command * @param output The stdout/stderr will be sent to this stream. * @return the int * @throws IOException the io exception * @throws InterruptedException the interrupted exception */ public int exec(String command, OutputStream output) throws IOException, InterruptedException { Session session = openSession(); try { session.execCommand(command); PumpThread t1 = new PumpThread(session.getStdout(), output); t1.start(); PumpThread t2 = new PumpThread(session.getStderr(), output); t2.start(); session.getStdin().close(); t1.join(); t2.join(); // wait for some time since the delivery of the exit status often gets delayed session.waitForCondition(ChannelCondition.EXIT_STATUS,3000); Integer r = session.getExitStatus(); if(r!=null) return r.intValue(); return -1; } finally { session.close(); } }
final Thread t1 = new StreamCopyThread("stdout copier: "+name,session.getStdout(), ps.stdout(),false); t1.start(); final Thread t2 = new StreamCopyThread("stderr copier: "+name,session.getStderr(), defaulted(ps.stderr(),ps.stdout()),false); t2.start(); final Thread t3 = new StreamCopyThread("stdin copier: "+name,ps.stdin(), session.getStdin(),true);
final Thread t1 = new StreamCopyThread("stdout copier: "+name,session.getStdout(), ps.stdout(),false); t1.start(); final Thread t2 = new StreamCopyThread("stderr copier: "+name,session.getStderr(), defaulted(ps.stderr(),ps.stdout()),false); t2.start(); final Thread t3 = new StreamCopyThread("stdin copier: "+name,ps.stdin(), session.getStdin(),true);
myInputStream = mySession.getStdout(); myInputStream = new BufferedInputStream(myInputStream, 16*1024); new StreamGobbler(mySession.getStderr()); myConnection = connection; return;