1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00

Stop using the Spawner when you don't need interrupt(). CygPath has been hanging when the underlying utility failed. Bug 156315 is once case of this.

This commit is contained in:
Doug Schaefer 2007-09-18 15:24:35 +00:00
parent c46d827e89
commit 8b988eb154
2 changed files with 3 additions and 6 deletions

View file

@ -16,8 +16,6 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
public class DiffUtil { public class DiffUtil {
private static final String DIFF_CMD = "diff -ub"; private static final String DIFF_CMD = "diff -ub";
private static DiffUtil fInstance; private static DiffUtil fInstance;
@ -75,7 +73,7 @@ public class DiffUtil {
private InputStream invokeDiff(String location1, String location2){ private InputStream invokeDiff(String location1, String location2){
try { try {
Process p = ProcessFactory.getFactory().exec(createCommand(location1, location2)); Process p = Runtime.getRuntime().exec(createCommand(location1, location2));
return p.getInputStream(); return p.getInputStream();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block

View file

@ -16,7 +16,6 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
@ -33,7 +32,7 @@ public class CygPath {
// Don't run this on non-windows platforms // Don't run this on non-windows platforms
throw new IOException("Not Windows"); //$NON-NLS-1$ throw new IOException("Not Windows"); //$NON-NLS-1$
String[] args = {command, "--windows", "--file", "-"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String[] args = {command, "--windows", "--file", "-"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
cygpath = ProcessFactory.getFactory().exec(args); cygpath = Runtime.getRuntime().exec(args);
stdin = new BufferedWriter(new OutputStreamWriter(cygpath.getOutputStream())); stdin = new BufferedWriter(new OutputStreamWriter(cygpath.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream())); stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream()));
try { try {
@ -81,7 +80,7 @@ public class CygPath {
Process cygPath = null; Process cygPath = null;
BufferedReader reader = null; BufferedReader reader = null;
try { try {
cygPath = ProcessFactory.getFactory().exec(new String[]{"cygpath", "-w", path}); //$NON-NLS-1$ //$NON-NLS-2$ cygPath = Runtime.getRuntime().exec(new String[]{"cygpath", "-w", path}); //$NON-NLS-1$ //$NON-NLS-2$
reader = new BufferedReader(new InputStreamReader(cygPath.getInputStream())); reader = new BufferedReader(new InputStreamReader(cygPath.getInputStream()));
String newPath = reader.readLine(); String newPath = reader.readLine();
IPath ipath; IPath ipath;