|
Lines 66-89
public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
Link Here
|
| 66 |
public String whichCommand(String command, IProject project) throws IOException { |
66 |
public String whichCommand(String command, IProject project) throws IOException { |
| 67 |
|
67 |
|
| 68 |
String[] envp = updateEnvironment(null, project); |
68 |
String[] envp = updateEnvironment(null, project); |
| 69 |
|
69 |
if (project != null) { |
| 70 |
try { |
70 |
try { |
| 71 |
proxy = RemoteProxyManager.getInstance().getFileProxy(project); |
71 |
proxy = RemoteProxyManager.getInstance().getFileProxy(project); |
| 72 |
URI whichUri = URI.create(WHICH_CMD); |
72 |
URI whichUri = URI.create(WHICH_CMD); |
| 73 |
IPath whichPath = new Path(proxy.toPath(whichUri)); |
73 |
IPath whichPath = new Path(proxy.toPath(whichUri)); |
| 74 |
IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project); |
74 |
IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project); |
| 75 |
Process pProxy = launcher.execute(whichPath, new String[]{command}, envp, null, new NullProgressMonitor()); |
75 |
Process pProxy = launcher.execute(whichPath, new String[]{command}, envp, null, new NullProgressMonitor()); |
| 76 |
if (pProxy != null){ |
76 |
if (pProxy != null){ |
| 77 |
BufferedReader error = new BufferedReader(new InputStreamReader(pProxy.getErrorStream())); |
77 |
BufferedReader error = new BufferedReader(new InputStreamReader(pProxy.getErrorStream())); |
| 78 |
if(error.readLine() != null){ |
78 |
if(error.readLine() != null){ |
| 79 |
throw new IOException(error.readLine()); |
79 |
throw new IOException(error.readLine()); |
|
|
80 |
} |
| 81 |
BufferedReader reader = new BufferedReader(new InputStreamReader(pProxy.getInputStream())); |
| 82 |
String readLine = reader.readLine(); |
| 83 |
command = readLine; |
| 80 |
} |
84 |
} |
| 81 |
BufferedReader reader = new BufferedReader(new InputStreamReader(pProxy.getInputStream())); |
85 |
} catch (CoreException e) { |
| 82 |
String readLine = reader.readLine(); |
86 |
e.printStackTrace(); |
| 83 |
command = readLine; |
|
|
| 84 |
} |
87 |
} |
| 85 |
} catch (CoreException e) { |
|
|
| 86 |
e.printStackTrace(); |
| 87 |
} |
88 |
} |
| 88 |
return command; |
89 |
return command; |
| 89 |
} |
90 |
} |
| 90 |
- |
|
|