diff --git a/src/text_editor/process.cpp b/src/text_editor/process.cpp index 7aaeebc..2342d30 100644 --- a/src/text_editor/process.cpp +++ b/src/text_editor/process.cpp @@ -250,8 +250,10 @@ Process SpawnProcess(ExecArgs args) { char *exe = Copy(scratch, args.exe).data; For (args.env) { - Add(&env, Copy(scratch, it).data); + Add(&env, it.data); } + Add(&env, (char *)"\0"); + int stdout_desc[2] = {}; int stdin_desc[2] = {}; @@ -403,7 +405,7 @@ void CloseStdin(Process *process) { } #else -Process SpawnProcess(String command_line, String working_dir, String write_stdin, Array enviroment) { return {}; } +Process SpawnProcess(ExecArgs args) { return {}; } bool IsValid(Process *process) { return false; } void KillProcess(Process *process) { } String PollStdout(Allocator allocator, Process *process, bool force_read) { return {}; } diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 44f8f12..5cb2e94 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -1,4 +1,6 @@ /* +- [ ] BRO, the caret teleports on linux when I press the arrow for too long + - [ ] Cleanups - [ ] How to enable framerate to be unlimited and not break scrolling? - [x] When dragging a file into the editor, would be nice if the file opened in the window user dropped the file into. Not the active window. @@ -10,6 +12,10 @@ - [ ] Directory tree doesn't make much sense! Maybe just consolidate into one folder? create nice names - the raddbg idea didn't pan out well here - [ ] Test BlockArena correctnsess - random allocations, writes and undos, try to crash +- [ ] General parser / data description thing + - [ ] Rewrite other parsers using this + - [ ] Rewrite Env handling (to not be OS specific) + - New error mechanism - we were losing errors when ReportError was called multiple times, I still want that but I don't want to lose errors, so turn it into a summary list of errors - [ ] BeginLog EndLog, and then show all logs as a list in the UI thing - [ ] Undo kinds (to enable history in fuzzy buffers) @@ -887,7 +893,7 @@ void MainLoop() { int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) #else extern char **environ; -int main(int argc, char **argv) +int main(int argc, char **argv, char **envp) #endif { #if OS_WINDOWS @@ -912,7 +918,7 @@ int main(int argc, char **argv) SDL_free(sdl_config_path.data); } - #if OS_WINDOWS +#if OS_WINDOWS { wchar_t *p = GetEnvironmentStringsW(); for (;p && p[0];) { @@ -924,8 +930,16 @@ int main(int argc, char **argv) // FreeEnvironmentStringsW(p); // I get a trap here? why? } #else - for (int i = 0; environ[i]; i += 1) { - Add(&ProcessEnviroment, Copy(Perm, environ[i])); + char **env = envp; + if (!env || !env[0]) { + env = environ; + } + if (env && env[0]) { + for (int i = 0; env[i]; i += 1) { + Add(&ProcessEnviroment, Copy(Perm, env[i])); + } + } else { + ReportErrorf("No environment variables found (envp/environ empty)"); } #endif diff --git a/src/text_editor/ui.cpp b/src/text_editor/ui.cpp index 49baadd..25777ad 100644 --- a/src/text_editor/ui.cpp +++ b/src/text_editor/ui.cpp @@ -530,6 +530,7 @@ BSet Open(Window *window, String path, ResolveOpenMeta meta, bool set_active = t CenterView(window->id); } else if (o.kind == OpenKind_Exec) { ExecArgs args = {};// ShellArgs(scratch, LogView->id, o.path, GetPrimaryDirectory()); + args.env = ProcessEnviroment; args.poll_process = 1; args.output_view = LogView->id; args.cwd = GetPrimaryDirectory();