Heyo, I'm having trouble getting Zig to pick up on certain environment variables, particularly ones that are set in the shell session rather than ?? however $USER et. al. are set:
# cat main.zig
const std = @import("std");
pub fn main() !void {
std.log.info("pre-defined env vars work: {s}", .{ std.os.getenv("USER").? });
std.log.info("explicitly set ones dont: {s}", .{ std.os.getenv("EDITOR").? });
}
# echo $USER
root
# echo $EDITOR
/usr/bin/vi
# ./main
info: pre-defined env vars work: root
thread 268 panic: attempt to use null value
/mnt/c/users/i/code/zk/mre/main.zig:5:77: 0x22cf88 in main (main)
std.log.info("explicitly set ones dont: {s}", .{ std.os.getenv("EDITOR").? });
What's up with that? 😅 And is there something I can do about it?