aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-10-11 03:43:07 (EDT)
committerzzhongwei2012-10-14 22:54:52 (EDT)
commita4e918343ca9143a751f39c6d36d792af452d290 (patch)
treee5837e6d902953ce7035d69c9bee5090c7b6ee44
parent1158884edcf2352c6353ce3e68f22e80956b7026 (diff)
downloadorg.eclipse.pdt-a4e918343ca9143a751f39c6d36d792af452d290.zip
org.eclipse.pdt-a4e918343ca9143a751f39c6d36d792af452d290.tar.gz
org.eclipse.pdt-a4e918343ca9143a751f39c6d36d792af452d290.tar.bz2
390594: Execution Environments dialog won't see php4 executable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390594
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java47
1 files changed, 30 insertions, 17 deletions
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java
index 37b7752..8139e96 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java
@@ -378,26 +378,20 @@ public class PHPexeItem {
"-n", "-c", tempPHPIni.getParentFile().getAbsolutePath(), "-v"); //$NON-NLS-1$ //$NON-NLS-2$
Matcher m = PHP_VERSION.matcher(output);
if (m.find()) {
- version = m.group(1);
- String type = m.group(2);
- if (type.startsWith("cgi")) { //$NON-NLS-1$
- sapiType = SAPI_CGI;
- } else if (type.startsWith("cli")) { //$NON-NLS-1$
- sapiType = SAPI_CLI;
+ initFields(m);
+ } else {
+ output = exec(
+ executable.getAbsolutePath(),
+ "-c", tempPHPIni.getParentFile().getAbsolutePath(), "-v"); //$NON-NLS-1$ //$NON-NLS-2$
+ m = PHP_VERSION.matcher(output);
+ if (m.find()) {
+ initFields(m);
} else {
PHPDebugPlugin
- .logErrorMessage("Can't determine type of the PHP executable"); //$NON-NLS-1$
+ .logErrorMessage("Can't determine version of the PHP executable"); //$NON-NLS-1$
// this.executable = null;
return;
}
-
- if (name == null) {
- name = "PHP " + version + " (" + sapiType + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- } else {
- PHPDebugPlugin
- .logErrorMessage("Can't determine version of the PHP executable"); //$NON-NLS-1$
- // this.executable = null;
return;
}
@@ -429,6 +423,25 @@ public class PHPexeItem {
}
}
+ private void initFields(Matcher m) {
+ version = m.group(1);
+ String type = m.group(2);
+ if (type.startsWith("cgi")) { //$NON-NLS-1$
+ sapiType = SAPI_CGI;
+ } else if (type.startsWith("cli")) { //$NON-NLS-1$
+ sapiType = SAPI_CLI;
+ } else {
+ PHPDebugPlugin
+ .logErrorMessage("Can't determine type of the PHP executable"); //$NON-NLS-1$
+ // this.executable = null;
+ return;
+ }
+
+ if (name == null) {
+ name = "PHP " + version + " (" + sapiType + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
/**
* Executes given command
*
@@ -445,8 +458,8 @@ public class PHPexeItem {
}
Process p = Runtime.getRuntime().exec(cmd, envParams);
- BufferedReader r = new BufferedReader(new InputStreamReader(p
- .getInputStream()));
+ BufferedReader r = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
StringBuilder buf = new StringBuilder();
String l;
while ((l = r.readLine()) != null) {