Skip to content

Commit

Permalink
Minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
crowbarmaster committed Oct 4, 2021
1 parent fe20dc0 commit 2b11b1c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions BedrockService/Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@ class Program

static void Main(string[] args)
{
if (args.Length == 0 && Environment.UserInteractive)
if (args.Length == 0 || Environment.UserInteractive)
{
IsConsoleMode = true;
InstanceProvider.ServiceLogger.AppendLine("BedrockService startup detected in Console mode.");
}
else
{
InstanceProvider.ServiceLogger.AppendLine("BedrockService startup detected in Service mode.");

foreach (Process process in Process.GetProcesses())
{
if (process.Id != ServicePID && process.ProcessName.StartsWith("BedrockService.") && process.ProcessName != "BedrockService.Client")
foreach (Process process in Process.GetProcesses())
{
InstanceProvider.ServiceLogger.AppendLine($"Found additional running instance of {process.ProcessName} with ID {process.Id}");
InstanceProvider.ServiceLogger.AppendLine($"Killing process with id {process.Id}");
process.Kill();
if (process.Id != ServicePID && process.ProcessName.StartsWith("BedrockService.") && process.ProcessName != "BedrockService.Client")
{
InstanceProvider.ServiceLogger.AppendLine($"Found additional running instance of {process.ProcessName} with ID {process.Id}");
InstanceProvider.ServiceLogger.AppendLine($"Killing process with id {process.Id}");
process.Kill();
}
}
}
}

Host host = HostFactory.New(x =>
{
x.SetStartTimeout(TimeSpan.FromSeconds(10));
Expand Down Expand Up @@ -77,7 +75,7 @@ static void Main(string[] args)

x.OnException((ex) =>
{
InstanceProvider.ServiceLogger.AppendLine("Exception occured Main : " + ex.ToString());
InstanceProvider.ServiceLogger.AppendLine("Exception occured Main : " + ex.Message);
});
});

Expand Down

0 comments on commit 2b11b1c

Please sign in to comment.