Fix working dir when spawning process

This commit is contained in:
2025-08-11 08:41:29 +02:00
parent 3e7f09f33f
commit a911707613

View File

@@ -257,11 +257,17 @@ Array<char *> SplitCommand(Allocator allocator, String command_line) {
}
Process SpawnProcess(String command_line, String working_dir, String write_stdin, Array<String> enviroment) {
Scratch scratch;
const int PIPE_READ = 0;
const int PIPE_WRITE = 1;
bool error = false;
Scratch scratch;
char *buffer = AllocArray(scratch, char, 4096);
chdir(working_dir.data);
getcwd(buffer, 4096);
defer { chdir(buffer); };
Process process = {};
UnixProcess *plat = (UnixProcess *)&process.platform;
Array<char *> args = SplitCommand(scratch, command_line);