Search in sources :

Example 1 with PTY

use of org.eclipse.cdt.utils.pty.PTY in project linuxtools by eclipse.

the class AbstractDataManipulator method performCommand.

public void performCommand(String[] cmd, String file) {
    Process proc = null;
    IRemoteFileProxy fileProxy;
    try {
        try {
            fileProxy = RemoteProxyManager.getInstance().getFileProxy(project);
        } catch (RemoteConnectionException e) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError);
            return;
        }
        IFileStore workDirStore = getWorkingDirStore();
        proc = RuntimeProcessFactory.getFactory().exec(cmd, null, workDirStore, project, new PTY());
        // $NON-NLS-1$
        DebugPlugin.newProcess(launch, proc, "");
        proc.waitFor();
        StringBuffer data = new StringBuffer();
        try (BufferedReader buffData = new BufferedReader(new InputStreamReader(fileProxy.getResource(file).openInputStream(EFS.NONE, null)))) {
            readStream(buffData, data);
            joinAll();
        }
        text = data.toString();
    } catch (IOException | CoreException e) {
        // $NON-NLS-1$
        text = "";
    } catch (InterruptedException e) {
        // $NON-NLS-1$
        text = "";
    }
}
Also used : RemoteConnectionException(org.eclipse.linuxtools.profiling.launch.RemoteConnectionException) PTY(org.eclipse.cdt.utils.pty.PTY) InputStreamReader(java.io.InputStreamReader) CoreException(org.eclipse.core.runtime.CoreException) IRemoteFileProxy(org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy) BufferedReader(java.io.BufferedReader) IFileStore(org.eclipse.core.filesystem.IFileStore) IOException(java.io.IOException)

Aggregations

BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 PTY (org.eclipse.cdt.utils.pty.PTY)1 IFileStore (org.eclipse.core.filesystem.IFileStore)1 CoreException (org.eclipse.core.runtime.CoreException)1 IRemoteFileProxy (org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy)1 RemoteConnectionException (org.eclipse.linuxtools.profiling.launch.RemoteConnectionException)1