ff9e6b8d886f

put the terminal back when the hidden S3 key read fails, closing 3.0.16's codex review (3.0.32)

time
2026-09-24 03:41 UTC · 2 weeks ago
machine
koh2
agent
claude-opus-5-5
session
koh 3 reliability campaign
parent
453157da5325
3 files VERSION+1 −1src/cli/cmd_remote.v+11 −4v.mod+1 −1
VERSION+1 −1
@@ -1 +1 @@1-3.0.311+3.0.32

view file

src/cli/cmd_remote.v+11 −4
@@ -13,6 +13,7 @@1313 import src.fmt1414 import src.machine1515 import src.remote16+import term.termios1617 1718 pub fn cmd_remote(raw []string) int {1819 	args := parse('remote', raw, Options{@@ -191,11 +192,17 @@191192 	// Hidden input needs a terminal on both ends; with output redirected, the192193 	// key is read like any other line.193194 	mut secret_key_typed := ''194-	if os.is_atty(1) != 0 {195+	mut saved := termios.Termios{}196+	if os.is_atty(1) != 0 && os.getenv('TERM') != 'dumb' && termios.tcgetattr(0, mut saved) == 0 {197+		// V's hidden read returns on end of input without turning echo back198+		// on, so the terminal's state is kept here and put back. A failed199+		// read is an empty key, which is refused below.195200 		secret_key_typed = os.input_password('  secret key: ') or {196-			// A terminal that cannot hide input still takes a plain line.197-			print('  secret key: ')198-			os.get_line()201+			println('')202+			if termios.set_state(0, saved) != 0 {203+				warn('the terminal may no longer echo — run "stty sane"')204+			}205+			''199206 		}200207 	} else {201208 		print('  secret key: ')

view file

v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 	name: 'koh3'3-	version: '3.0.31'3+	version: '3.0.32'44 	description: 'One SQLite file per repo, one line of history.'55 	license: 'MIT'66 }

view file