windows: add support for the glfw backend on Windows

Changes:
- Add WindowsPty, which uses the ConPTY API to create a pseudo console
- Pty now selects between PosixPty and WindowsPty
- Windows support in Command, including the ability to launch a process with a pseudo console
- Enable Command tests on windows
- Add some environment variable abstractions to handle the missing libc APIs on Windows
- Windows version of ReadThread
This commit is contained in:
kcbanner
2023-10-29 04:03:06 -04:00
committed by Mitchell Hashimoto
parent 04ef21653f
commit 232df8de8f
13 changed files with 795 additions and 234 deletions

View File

@@ -243,7 +243,8 @@ pub const GlobalState = struct {
// maybe once for logging) so for now this is an easy way to do
// this. Env vars are useful for logging too because they are
// easy to set.
if (std.os.getenv("GHOSTTY_LOG")) |v| {
if ((try internal_os.getEnvVarOwned(self.alloc, "GHOSTTY_LOG"))) |v| {
defer self.alloc.free(v);
if (v.len > 0) {
self.logging = .{ .stderr = {} };
}
@@ -265,7 +266,7 @@ pub const GlobalState = struct {
// We need to make sure the process locale is set properly. Locale
// affects a lot of behaviors in a shell.
internal_os.ensureLocale();
try internal_os.ensureLocale(self.alloc);
}
/// Cleans up the global state. This doesn't _need_ to be called but