Author: mhutch
Date: 2007-11-20 12:33:01 -0500 (Tue, 20 Nov 2007)
New Revision: 89997

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs
   trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
Log:
* MonoDevelop.Core.Execution/ProcessService.cs: Add API to allow global
  override of environment variables on processes launched from
  MonoDevelop. Part of fix for "Bug 342965 - When running my program
  from monodevelop (F5) MONO_MANAGED_WATCHER is enabled".
* MonoDevelop.Core/Runtime.cs: Convert a writeline to a log message.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog       2007-11-20 
17:24:29 UTC (rev 89996)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog       2007-11-20 
17:33:01 UTC (rev 89997)
@@ -1,3 +1,11 @@
+2007-11-20  Michael Hutchinson <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Core.Execution/ProcessService.cs: Add API to allow global
+         override of environment variables on processes launched from
+         MonoDevelop. Part of fix for "Bug 342965 - When running my program 
from
+         monodevelop (F5) MONO_MANAGED_WATCHER is enabled".
+       * MonoDevelop.Core/Runtime.cs: Convert a writeline to a log message.
+
 2007-11-17  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Core.mdp, Makefile.am, MonoDevelop.Core/Runtime.cs,

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs     
2007-11-20 17:24:29 UTC (rev 89996)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs     
2007-11-20 17:33:01 UTC (rev 89997)
@@ -176,7 +176,7 @@
                        try {
                                return app.Run (parameters);
                        } catch (Exception ex) {
-                               Console.WriteLine (ex);
+                               LoggingService.LogFatalError (ex.ToString ());
                                return -1;
                        }
                }

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs
    2007-11-20 17:24:29 UTC (rev 89996)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs
    2007-11-20 17:33:01 UTC (rev 89997)
@@ -22,6 +22,28 @@
                string remotingChannel = "unix";
                string unixRemotingFile;
                
+               Dictionary<string, string> environmentVariableOverrides = null;
+               
+               public IDictionary<string, string> EnvironmentVariableOverrides 
{
+                       get {
+                               if (environmentVariableOverrides == null)
+                                       environmentVariableOverrides = new 
Dictionary<string,string> ();
+                               return environmentVariableOverrides;
+                       }
+               }
+               
+               void ProcessEnvironmentVariableOverrides (ProcessStartInfo info)
+               {
+                       if (environmentVariableOverrides == null)
+                               return;
+                       foreach (KeyValuePair<string, string> kvp in 
environmentVariableOverrides) {
+                               if (kvp.Value == null && 
info.EnvironmentVariables.ContainsKey (kvp.Key))
+                                       info.EnvironmentVariables.Remove 
(kvp.Key);
+                               else
+                                       info.EnvironmentVariables[kvp.Key] = 
kvp.Value;
+                       }
+               }
+               
                public override void InitializeService ()
                {
                        if (PlatformID.Unix != Environment.OSVersion.Platform) {
@@ -87,6 +109,7 @@
                                p.Exited += exited;
                                
                        p.StartInfo = startInfo;
+                       ProcessEnvironmentVariableOverrides (p.StartInfo);
                        p.EnableRaisingEvents = true;
                        
                        p.Start ();
@@ -155,6 +178,7 @@
                                        p.Exited += exited;
                                
                                p.StartInfo = psi;
+                               ProcessEnvironmentVariableOverrides 
(p.StartInfo);
                                p.Start();
                                return p;
                        } else {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to