|
Lines 14-19
Link Here
|
| 14 |
|
14 |
|
| 15 |
import java.io.File; |
15 |
import java.io.File; |
| 16 |
import java.io.IOException; |
16 |
import java.io.IOException; |
|
|
17 |
import java.io.InputStream; |
| 18 |
import java.io.OutputStream; |
| 17 |
import java.util.ArrayList; |
19 |
import java.util.ArrayList; |
| 18 |
import java.util.Arrays; |
20 |
import java.util.Arrays; |
| 19 |
|
21 |
|
|
Lines 93-99
Link Here
|
| 93 |
String[] commandArray = (String[])command.toArray(new String[command.size()]); |
95 |
String[] commandArray = (String[])command.toArray(new String[command.size()]); |
| 94 |
boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); |
96 |
boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); |
| 95 |
monitor.worked(2); |
97 |
monitor.worked(2); |
| 96 |
Process process = exec(commandArray, getEnvironment(config), wd, usePty); |
98 |
PTY pty = null; |
|
|
99 |
if (usePty && PTY.isSupported()) { |
| 100 |
try { |
| 101 |
pty = new PTY(); |
| 102 |
} catch (IOException e) { |
| 103 |
abort(LaunchMessages.LocalCDILaunchDelegate_8, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
| 104 |
} |
| 105 |
} |
| 106 |
Process process = exec(commandArray, getEnvironment(config), wd, pty); |
| 107 |
if (pty != null) { |
| 108 |
final Process _spawner = process; |
| 109 |
final PTY _pty = pty; |
| 110 |
process = new Process() { |
| 111 |
@Override |
| 112 |
public void destroy() { _spawner.destroy(); } |
| 113 |
@Override |
| 114 |
public int exitValue() { return _spawner.exitValue(); } |
| 115 |
@Override |
| 116 |
public OutputStream getOutputStream() { return _pty.getOutputStream(); } |
| 117 |
@Override |
| 118 |
public InputStream getInputStream() { return _pty.getInputStream(); } |
| 119 |
@Override |
| 120 |
public InputStream getErrorStream() { return _spawner.getErrorStream(); } |
| 121 |
@Override |
| 122 |
public int waitFor() throws InterruptedException { return _spawner.waitFor(); } |
| 123 |
}; |
| 124 |
} |
| 97 |
monitor.worked(6); |
125 |
monitor.worked(6); |
| 98 |
DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0])); |
126 |
DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0])); |
| 99 |
} finally { |
127 |
} finally { |
|
Lines 356-370
Link Here
|
| 356 |
* cancelled |
384 |
* cancelled |
| 357 |
* @see Runtime |
385 |
* @see Runtime |
| 358 |
*/ |
386 |
*/ |
| 359 |
protected Process exec(String[] cmdLine, String[] environ, File workingDirectory, boolean usePty) throws CoreException { |
387 |
protected Process exec(String[] cmdLine, String[] environ, File workingDirectory, PTY pty) throws CoreException { |
| 360 |
Process p = null; |
388 |
Process p = null; |
| 361 |
try { |
389 |
try { |
| 362 |
if (workingDirectory == null) { |
390 |
if (workingDirectory == null) { |
| 363 |
p = ProcessFactory.getFactory().exec(cmdLine, environ); |
391 |
p = ProcessFactory.getFactory().exec(cmdLine, environ); |
| 364 |
} |
392 |
} |
| 365 |
else { |
393 |
else { |
| 366 |
if (usePty && PTY.isSupported()) { |
394 |
if (pty != null) { |
| 367 |
p = ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory, new PTY()); |
395 |
p = ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory, pty); |
| 368 |
} |
396 |
} |
| 369 |
else { |
397 |
else { |
| 370 |
p = ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory); |
398 |
p = ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory); |
|
Lines 385-391
Link Here
|
| 385 |
if (handler != null) { |
413 |
if (handler != null) { |
| 386 |
Object result = handler.handleStatus(status, this); |
414 |
Object result = handler.handleStatus(status, this); |
| 387 |
if (result instanceof Boolean && ((Boolean)result).booleanValue()) { |
415 |
if (result instanceof Boolean && ((Boolean)result).booleanValue()) { |
| 388 |
p = exec(cmdLine, environ, null, usePty); |
416 |
p = exec(cmdLine, environ, null, pty); |
| 389 |
} |
417 |
} |
| 390 |
} |
418 |
} |
| 391 |
} |
419 |
} |