Syntax for executing shell commands

This commit is contained in:
Krzosa Karol
2024-08-08 11:06:51 +02:00
parent ad2efab7c8
commit 3488c71155
5 changed files with 20 additions and 7 deletions

View File

@@ -84,6 +84,12 @@ bool AreEqual(String16 a, String16 b, unsigned ignore_case = false) {
inline bool operator==(String16 a, String16 b) { return AreEqual(a, b); }
inline bool operator!=(String16 a, String16 b) { return !AreEqual(a, b); }
wchar_t GetChar(String16 string, int64_t i) {
wchar_t result = 0;
if (i < string.len) result = string.data[i];
return result;
}
String16 Merge(Allocator allocator, Array<String16> list, String16 separator = " ") {
int64_t char_count = 0;
For(list) char_count += it.len;

View File

@@ -367,8 +367,11 @@ Process CreateCommandLineProcess(String command_line, String working_dir) {
String16 cmd = ToString16(scratch, command_line);
void *env = NULL;
DWORD dwCreationFlags = 0;
BOOL bInheritHandles = TRUE;
PROCESS_INFORMATION info = {};
if (!CreateProcessW(L"c:\\windows\\system32\\cmd.exe", cmd.data, 0, 0, TRUE, 0, env, cwd.data, &startup, &info)) {
if (!CreateProcessW(L"c:\\windows\\system32\\cmd.exe", cmd.data, 0, 0, bInheritHandles, dwCreationFlags, env, cwd.data, &startup, &info)) {
Win32ProcessError(&process, "failed to create process", command_line);
return process;
}