Issue #10: implement worker process launcher
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
namespace MxGateway.Server.Workers;
|
||||
|
||||
public sealed class WorkerProcessCommandLine
|
||||
{
|
||||
public WorkerProcessCommandLine(
|
||||
string executablePath,
|
||||
IReadOnlyList<string> arguments)
|
||||
{
|
||||
ExecutablePath = executablePath;
|
||||
Arguments = arguments;
|
||||
}
|
||||
|
||||
public string ExecutablePath { get; }
|
||||
|
||||
public IReadOnlyList<string> Arguments { get; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Join(
|
||||
" ",
|
||||
new[] { Quote(ExecutablePath) }.Concat(Arguments.Select(Quote)));
|
||||
}
|
||||
|
||||
private static string Quote(string value)
|
||||
{
|
||||
return value.Contains(' ', StringComparison.Ordinal)
|
||||
? $"\"{value}\""
|
||||
: value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user