Refactor platform process startup with CreateProcessSettings

This commit is contained in:
Wojtek Figat
2023-03-22 14:09:20 +01:00
parent 497aca829d
commit 3bbc7faf11
11 changed files with 351 additions and 281 deletions

View File

@@ -552,23 +552,50 @@ bool PlatformBase::SetEnvironmentVariable(const String& name, const String& valu
return true;
}
int32 PlatformBase::StartProcess(const StringView& filename, const StringView& args, const StringView& workingDir, bool hiddenWindow, bool waitForEnd)
int32 PlatformBase::CreateProcess(CreateProcessSettings& settings)
{
// Not supported
return -1;
}
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#include "Engine/Platform/CreateProcessSettings.h"
int32 PlatformBase::StartProcess(const StringView& filename, const StringView& args, const StringView& workingDir, bool hiddenWindow, bool waitForEnd)
{
CreateProcessSettings procSettings;
procSettings.FileName = filename;
procSettings.Arguments = args;
procSettings.WorkingDirectory = workingDir;
procSettings.HiddenWindow = hiddenWindow;
procSettings.WaitForEnd = waitForEnd;
procSettings.LogOutput = waitForEnd;
procSettings.ShellExecute = true;
return CreateProcess(procSettings);
}
int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& workingDir, bool hiddenWindow)
{
return Platform::RunProcess(cmdLine, workingDir, Dictionary<String, String>(), hiddenWindow);
CreateProcessSettings procSettings;
procSettings.FileName = cmdLine;
procSettings.WorkingDirectory = workingDir;
procSettings.HiddenWindow = hiddenWindow;
return CreateProcess(procSettings);
}
int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& workingDir, const Dictionary<String, String>& environment, bool hiddenWindow)
{
// Not supported
return -1;
CreateProcessSettings procSettings;
procSettings.FileName = cmdLine;
procSettings.WorkingDirectory = workingDir;
procSettings.Environment = environment;
procSettings.HiddenWindow = hiddenWindow;
return CreateProcess(procSettings);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
Array<PlatformBase::StackFrame> PlatformBase::GetStackFrames(int32 skipCount, int32 maxDepth, void* context)
{
return Array<StackFrame>();