os: rename env to be posix-like, do not allocate on posix

This commit is contained in:
Mitchell Hashimoto
2023-11-05 15:39:25 -08:00
parent 7594bbd621
commit 8f35d5251e
3 changed files with 68 additions and 46 deletions

View File

@@ -243,9 +243,9 @@ 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 ((try internal_os.getEnvVarOwned(self.alloc, "GHOSTTY_LOG"))) |v| {
defer self.alloc.free(v);
if (v.len > 0) {
if ((try internal_os.getenv(self.alloc, "GHOSTTY_LOG"))) |v| {
defer v.deinit(self.alloc);
if (v.value.len > 0) {
self.logging = .{ .stderr = {} };
}
}