You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2026/07/16 14:27:12 UTC

(tinkerpop) 02/04: Restore terminal echo after process-docs.sh completes

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 89bc2930dcf21dae3091c287bc8a64fba6399cfe
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Thu Jul 16 10:18:52 2026 -0400

    Restore terminal echo after process-docs.sh completes
    
    The console subprocesses put the shared tty into raw mode and don't always
    restore it, leaving the invoking shell unable to echo typed characters.
    
    Assisted-by: Claude Code:claude-opus-4-8
---
 bin/process-docs.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bin/process-docs.sh b/bin/process-docs.sh
index 0a47a5ac2d..b4cebbbf76 100755
--- a/bin/process-docs.sh
+++ b/bin/process-docs.sh
@@ -55,12 +55,25 @@ done
 GREMLIN_SERVER_PID=""
 GEPHI_MOCK_PID=""
 
+# The console subprocesses spawned by the docs extension drive JLine, which puts the shared
+# controlling terminal into raw mode (echo off) even though its own stdin/stdout are pipes. A
+# console that is killed rather than shut down cleanly never restores those settings, leaving
+# the invoking shell unable to echo typed characters. Snapshot the settings here and restore
+# them on exit.
+STTY_SAVED=""
+if [ -t 0 ]; then
+  STTY_SAVED=$(stty -g 2>/dev/null || true)
+fi
+
 cleanup() {
   set +e
   [ -n "${GREMLIN_SERVER_PID}" ] && kill "${GREMLIN_SERVER_PID}" 2>/dev/null
   [ -n "${GEPHI_MOCK_PID}" ] && kill "${GEPHI_MOCK_PID}" 2>/dev/null
+  [ -n "${STTY_SAVED}" ] && stty "${STTY_SAVED}" 2>/dev/null
 }
 trap cleanup EXIT
+trap 'cleanup; exit 130' INT
+trap 'cleanup; exit 143' TERM
 
 # ---------------------------------------------------------------------------
 # Dry-run mode