Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 52438 Details for
Bug 161770
IShellService.runCommand fails with SSH
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
helper class needed by previous attachment
HostShellAdapter.java (text/plain), 2.62 KB, created by
Lothar Werzinger
on 2006-10-20 18:01:29 EDT
(
hide
)
Description:
helper class needed by previous attachment
Filename:
MIME Type:
Creator:
Lothar Werzinger
Created:
2006-10-20 18:01:29 EDT
Size:
2.62 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2006 PalmSource, Inc. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * Ewa Matejska (PalmSource) > *******************************************************************************/ > >package samples.ui.actions; > >import java.io.IOException; >import java.io.InputStream; >import java.io.OutputStream; >import java.io.PipedInputStream; >import java.io.PipedOutputStream; >import java.io.PrintStream; > >import org.eclipse.rse.services.shells.IHostShell; >import org.eclipse.rse.services.shells.IHostShellChangeEvent; >import org.eclipse.rse.services.shells.IHostShellOutputListener; > >public class HostShellAdapter extends Process implements >IHostShellOutputListener { > > private IHostShell hostShell; > > private PrintStream hostShellInput = null; > private PrintStream hostShellError = null; > > > public HostShellAdapter(IHostShell hostShell) throws java.io.IOException { > this.hostShell = hostShell; > hostShellInput = System.out; > hostShellError = System.err; > this.hostShell.getStandardOutputReader().addOutputListener(this); > this.hostShell.getStandardErrorReader().addOutputListener(this); > } > > public synchronized void destroy() { > hostShell.exit(); > notifyAll(); > } > > public int exitValue() { > if(hostShell.isActive()) > throw new IllegalThreadStateException(); > // No way to tell what the exit value was. > return 0; > } > > public synchronized int waitFor() throws InterruptedException { > while(hostShell.isActive()) > wait(); > return 0; > } > > public void shellOutputChanged(IHostShellChangeEvent event) { > Object[] input = event.getLines(); > OutputStream outputStream = event.isError() ? hostShellError : hostShellInput; > try { > for(int i = 0; i < input.length; i++) { > outputStream.write(input[i].toString().getBytes()); > outputStream.write('\n'); > outputStream.flush(); > } > } catch(IOException e) { > // Ignore > } > } > > /* (non-Javadoc) > * @see java.lang.Process#getErrorStream() > */ > public InputStream getErrorStream() > { > // TODO Auto-generated method stub > return null; > } > > /* (non-Javadoc) > * @see java.lang.Process#getInputStream() > */ > public InputStream getInputStream() > { > // TODO Auto-generated method stub > return null; > } > > /* (non-Javadoc) > * @see java.lang.Process#getOutputStream() > */ > public OutputStream getOutputStream() > { > // TODO Auto-generated method stub > return null; > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 161770
:
52437
| 52438