Fix for launching inline

This commit is contained in:
2023-11-19 16:09:38 -05:00
parent 499e0f2cc7
commit 158521ba05

View File

@@ -54,14 +54,20 @@ void EnsureProcessRunning(ProcessInfo processInfo, int desiredCount)
for (int i = 0; i < countToStart; i++)
{
ProcessStartInfo startInfo = new ProcessStartInfo
if (openInNewWindow)
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
Process.Start(startInfo);
} else
{
Process.Start(processInfo.Path);
}
Process.Start(startInfo);
Console.WriteLine($"Started {processInfo.Name} at {DateTime.Now}");
AppendToLogFile(processInfo, "launched");
}
@@ -84,13 +90,20 @@ void ScheduleProcessStart(ProcessInfo processInfo)
var runningProcesses = Process.GetProcessesByName(processInfo.Name);
if (runningProcesses.Length == 0)
{
ProcessStartInfo startInfo = new ProcessStartInfo
if (openInNewWindow)
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
Process.Start(startInfo);
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
Process.Start(startInfo);
}
else
{
Process.Start(processInfo.Path);
}
AppendToLogFile(processInfo, "run");
}
else
@@ -112,13 +125,20 @@ void ScheduleRepeatedExecution(ProcessInfo processInfo)
var runningProcesses = Process.GetProcessesByName(processInfo.Name);
if (runningProcesses.Length == 0)
{
ProcessStartInfo startInfo = new ProcessStartInfo
if (openInNewWindow)
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
Process.Start(startInfo);
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = processInfo.Path,
CreateNoWindow = !openInNewWindow, // Controlled by the user's choice
UseShellExecute = true, // Use the system shell to start the process
};
Process.Start(startInfo);
}
else
{
Process.Start(processInfo.Path);
}
Console.WriteLine($"Started {processInfo.Name} at {DateTime.Now}");
AppendToLogFile(processInfo, "run");
} else