Signed-off-by: Ioana Grigoropol <ioanax.grigoro...@intel.com> --- .../org/yocto/bc/remote/utils/RemoteHelper.java | 27 +++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java index 507ac54..87c8637 100644 --- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java @@ -35,6 +35,7 @@ import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.internal.services.local.shells.LocalHostShell; import org.eclipse.rse.services.IService; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.files.IFileService; @@ -87,18 +88,31 @@ public class RemoteHelper { if (hostShell == null) throw new Exception("An error has occured while trying to run remote command!"); - Lock lock = hostShell.getLock(); - lock.lock(); + Lock lock = null; + if (hostShell instanceof LocalHostShell) { + lock = ((LocalHostShell)hostShell).getLock(); + lock.lock(); + } ProcessStreamBuffer processBuffer = new ProcessStreamBuffer(); - BufferedReader inbr = hostShell.getReader(false); - BufferedReader errbr = hostShell.getReader(true); + BufferedReader inbr = null; + BufferedReader errbr = null; + + if (hostShell instanceof LocalHostShell) { + inbr = ((LocalHostShell)hostShell).getReader(false); + errbr = ((LocalHostShell)hostShell).getReader(true); + } else { + Process p = new HostShellProcessAdapter(hostShell); + inbr = new BufferedReader(new InputStreamReader(p.getInputStream())); + errbr = new BufferedReader(new InputStreamReader(p.getErrorStream())); + } boolean cancel = false; while (!cancel) { if(monitor.isCanceled()) { cancel = true; - lock.unlock(); + if (lock != null) + lock.unlock(); throw new InterruptedException("User Cancelled"); } StringBuffer buffer = new StringBuffer(); @@ -135,7 +149,8 @@ public class RemoteHelper { } cancel = true; } - lock.unlock(); + if (lock != null) + lock.unlock(); return processBuffer; } -- 1.7.9.5 _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto