authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-08-24 02:28:31+10:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-08-24 02:28:31+10:00
log129d3e274dbc3e11a30e3d54c5da7a944ddcf4f0
tree386d6b361b9fb75ebb8d09f0e4aeb817cb6aa38c
parent23a81b439638fee89054ad749f0348ab7d107619
signaturelock-open Commit is signed but in an unrecognized format.

std: use O_NOCTTY flag


2 files changed, 7 insertions(+), 0 deletions(-)

lib/std/fs.zig+3
......@@ -704,6 +704,9 @@ pub const Dir = struct {
704704 if (@hasDecl(os, "O_LARGEFILE")) {
705705 os_flags |= os.O_LARGEFILE;
706706 }
707 if (!flags.allow_ctty) {
708 os_flags |= os.O_NOCTTY;
709 }
707710 os_flags |= if (flags.write and flags.read)
708711 @as(u32, os.O_RDWR)
709712 else if (flags.write)
lib/std/fs/file.zig+4
......@@ -101,6 +101,10 @@ pub const File = struct {
101101 /// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions
102102 /// related to opening the file, reading, writing, and locking.
103103 intended_io_mode: io.ModeOverride = io.default_mode,
104
105 /// Set this to allow the opened file to automatically become the
106 /// controlling TTY for the current process.
107 allow_ctty: bool = false,
104108 };
105109
106110 /// TODO https://github.com/ziglang/zig/issues/3802