From b0d1112f249f194cee991b4955e8de2a143838ef Mon Sep 17 00:00:00 2001 From: fvicente Date: Sun, 9 Nov 2003 03:04:14 +0000 Subject: [PATCH] environment variables inheritance fixed --- .../phpdt/internal/launching/DebuggerRunner.java | 26 ++++++++++++++++---- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java index 203a5b4..c7bb124 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java @@ -27,11 +27,27 @@ public class DebuggerRunner extends InterpreterRunner { public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) { String[] env; + String name, value; PHPDBGProxy newPHPDBGProxy= new PHPDBGProxy(); + int pos; + newPHPDBGProxy.start(); - env= setEnvironmentVariables(newPHPDBGProxy.getPort(), configuration.getAbsoluteFileName()); - - IProcess process = super.run(configuration, launch, env); + env= setEnvironmentVariables(newPHPDBGProxy.getPort(), configuration.getAbsoluteFileName(), configuration.getInterpreter().getCommand()); + + for(int i= 0; i < env.length; i++) { + pos= env[i].indexOf("="); + if(pos > -1) { + name= env[i].substring(0, pos); + value= env[i].substring(pos + 1); + } else { + name= env[i]; + value= ""; + } + Environment.setenv(name, value); + } + // now enviroment settings is made with Environment class + // because if new parameters are passed by array, doesn't inherit system vars + IProcess process = super.run(configuration, launch, null); PHPDebugTarget debugTarget = new PHPDebugTarget(launch, process); newPHPDBGProxy.setDebugTarget(debugTarget); launch.addDebugTarget(debugTarget); @@ -39,7 +55,7 @@ public class DebuggerRunner extends InterpreterRunner { return process; } - protected String[] setEnvironmentVariables(int listenPort, String AbsoluteFileName) { + protected String[] setEnvironmentVariables(int listenPort, String AbsoluteFileName, String interpreter) { IPath FilePath= new Path(AbsoluteFileName); String OSFilePath= FilePath.toOSString(); String DBGSessID; @@ -56,7 +72,7 @@ public class DebuggerRunner extends InterpreterRunner { env[6]= "SERVER_ADDR=127.0.0.1"; env[7]= "SERVER_PORT=80"; env[8]= "REMOTE_ADDR=127.0.0.1"; - env[9]= "SCRIPT_FILENAME=c:\\php\\php.exe"; + env[9]= "SCRIPT_FILENAME=" + interpreter; env[10]= "GATEWAY_INTERFACE=CGI / 1.1"; env[11]= "SERVER_PROTOCOL=HTTP / 1.1"; env[12]= "REQUEST_METHOD=GET"; -- 1.7.1