mirror of https://github.com/winsw/winsw
Generalize usage of System environment variables for processes
parent
0a59da5f98
commit
5e835479ae
|
@ -72,7 +72,11 @@ namespace winsw
|
|||
Environment.SetEnvironmentVariable("BASE", d.FullName);
|
||||
// ditto for ID
|
||||
Environment.SetEnvironmentVariable("SERVICE_ID", Id);
|
||||
Environment.SetEnvironmentVariable("WINSW_EXECUTABLE", ExecutablePath);
|
||||
|
||||
// New name
|
||||
Environment.SetEnvironmentVariable(WinSWSystem.ENVVAR_NAME_EXECUTABLE_PATH, ExecutablePath);
|
||||
// Also inject system environment variables
|
||||
Environment.SetEnvironmentVariable(WinSWSystem.ENVVAR_NAME_SERVICE_ID, Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<Compile Include="Util\SigIntHelper.cs" />
|
||||
<Compile Include="Util\XmlHelper.cs" />
|
||||
<Compile Include="WinSWException.cs" />
|
||||
<Compile Include="WinSWSystem.cs" />
|
||||
<Compile Include="Wmi.cs" />
|
||||
<Compile Include="WmiSchema.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace winsw
|
||||
{
|
||||
/// <summary>
|
||||
/// Class, which contains generic information about WinSW runtime.
|
||||
/// This information can be used by the service and extensions.
|
||||
/// </summary>
|
||||
public class WinSWSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Prefix for all environment variables being injected for WinSW
|
||||
/// </summary>
|
||||
public static readonly string SYSTEM_EVNVVAR_PREFIX = "WINSW_";
|
||||
|
||||
/// <summary>
|
||||
/// Variable, which points to the service ID.
|
||||
/// It may be used to determine runaway processes.
|
||||
/// </summary>
|
||||
public static string ENVVAR_NAME_SERVICE_ID { get { return SYSTEM_EVNVVAR_PREFIX + "SERVICE_ID"; } }
|
||||
|
||||
/// <summary>
|
||||
/// Variable, which specifies path to the executable being launched by WinSW.
|
||||
/// </summary>
|
||||
public static string ENVVAR_NAME_EXECUTABLE_PATH { get { return SYSTEM_EVNVVAR_PREFIX + "EXECUTABLE"; } }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue