Browse Source

Expose the ID of the service

Process launched from winsw can use these information to talk back to winsw.exe
Kohsuke Kawaguchi 11 years ago
parent
commit
2ffdbde6a9
1 changed files with 6 additions and 3 deletions
  1. 6 3
      ServiceDescriptor.cs

+ 6 - 3
ServiceDescriptor.cs

@@ -63,13 +63,16 @@ namespace winsw
                     break;
             }
 
-            // register the base directory as environment variable so that future expansions can refer to this.
-            Environment.SetEnvironmentVariable("BASE", p);
-
             BaseName = baseName;
             BasePath = Path.Combine(p, BaseName);
 
             dom.Load(BasePath + ".xml");
+
+            // register the base directory as environment variable so that future expansions can refer to this.
+            Environment.SetEnvironmentVariable("BASE", p);
+            // ditto for ID
+            Environment.SetEnvironmentVariable("SERVICE_ID", Id);
+            Environment.SetEnvironmentVariable("WINSW_EXECUTABLE", ExecutablePath);
         }
 
         /// <summary>