╭ changed ─────────────────╮ │src/serve_ssh_protocol.zig│ ╰──────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │301 │ │302 /// what the client wants to do on this channel. │ │303 pub const Request = union(enum) { │ │304 - shell: ?PtySize, // pty info if a pty-req arrived before the shell │ │304 + shell: Shell, │ │305 exec: Exec, │ │306 │ │307 + pub const Shell = struct { │ │308 + /// pty info if a pty-req arrived before the shell │ │309 + pty: ?PtySize, │ │310 + /// false if a non-empty NO_COLOR env value arrived before the shell│ │311 + color: bool, │ │312 + }; │ │313 + │ │314 pub const Exec = struct { │ │315 command: []const u8, │ │316 /// the GIT_PROTOCOL env value, if one arrived before the exec │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │1899 remote_window: u32, // bytes we may still send to peer before they adjust │ │1900 max_packet: u32, // max CHANNEL_DATA payload the peer accepts in one packet│ │1901 pty: ?PtySize = null, │ │1895 - // value of GIT_PROTOCOL, the one env variable we keep │ │1902 + // value of GIT_PROTOCOL, one of the two env variables we keep │ │1903 git_protocol_buf: [64]u8 = undefined, │ │1904 git_protocol_len: ?usize = null, │ │1905 + // false when NO_COLOR is set, the other env variable we keep │ │1906 + color: bool = true, │ │1907 }; │ │1908 │ │1909 pub const PtySize = struct { width_cells: u16, height_cells: u16 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │2105 if (std.mem.eql(u8, name, "GIT_PROTOCOL") and value.len <= ch.git_protocol_buf.len) {│ │2106 @memcpy(ch.git_protocol_buf[0..value.len], value); │ │2107 ch.git_protocol_len = value.len; │ │2108 + } else if (std.mem.eql(u8, name, "NO_COLOR")) { │ │2109 + ch.color = value.len == 0; │ │2110 } │ │2111 try replyChannelRequest(conn, ch, want_reply, true); │ │2112 return null; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │2123 │ │2124 if (std.mem.eql(u8, req_type, "shell")) { │ │2125 try replyChannelRequest(conn, ch, want_reply, true); │ │2115 - return .{ .shell = ch.pty }; │ │2126 + return .{ .shell = .{ .pty = ch.pty, .color = ch.color } };│ │2127 } │ │2128 │ │2129 if (std.mem.eql(u8, req_type, "exec")) { │ ╰─────────────────────────────────────────────────────────────────────────╯