summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java')
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java
new file mode 100644
index 0000000..8cbda18
--- /dev/null
+++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java
@@ -0,0 +1,44 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ioana Grigoropol(Intel) - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.core.runtime.CoreException;
14import org.eclipse.core.runtime.IProgressMonitor;
15import org.eclipse.rse.core.model.IHost;
16import org.eclipse.rse.services.shells.IHostShell;
17
18public class CommandRunnable implements Runnable{
19 private IHostShell hostShell;
20 private final IHost connection;
21 private final YoctoCommand cmd;
22 private final IProgressMonitor monitor;
23 private final CommandResponseHandler cmdHandler;
24
25 CommandRunnable(IHost connection, YoctoCommand cmd, IProgressMonitor monitor){
26 this.connection = connection;
27 this.cmdHandler = RemoteHelper.getCommandHandler(connection);
28 this.cmd = cmd;
29 this.monitor = monitor;
30 this.hostShell = null;
31 }
32 @Override
33 public void run() {
34 try {
35 hostShell = RemoteHelper.runCommandRemote(connection, cmd, monitor);
36 cmd.setProcessBuffer(RemoteHelper.processOutput(monitor, hostShell, cmdHandler));
37 } catch (CoreException e) {
38 e.printStackTrace();
39 } catch (Exception e) {
40 e.printStackTrace();
41 }
42 }
43
44}