Commit 129d3e274d
lib/std/fs/file.zig
@@ -101,6 +101,10 @@ pub const File = struct {
/// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions
/// related to opening the file, reading, writing, and locking.
intended_io_mode: io.ModeOverride = io.default_mode,
+
+ /// Set this to allow the opened file to automatically become the
+ /// controlling TTY for the current process.
+ allow_ctty: bool = false,
};
/// TODO https://github.com/ziglang/zig/issues/3802
lib/std/fs.zig
@@ -704,6 +704,9 @@ pub const Dir = struct {
if (@hasDecl(os, "O_LARGEFILE")) {
os_flags |= os.O_LARGEFILE;
}
+ if (!flags.allow_ctty) {
+ os_flags |= os.O_NOCTTY;
+ }
os_flags |= if (flags.write and flags.read)
@as(u32, os.O_RDWR)
else if (flags.write)