]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: commit-msg: fix terminal corruption when re-editing
authorPádraig Brady <P@draigBrady.com>
Sat, 29 Nov 2025 20:36:14 +0000 (20:36 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 29 Nov 2025 20:36:14 +0000 (20:36 +0000)
* scripts/git-hooks/commit-msg: Explicitly connect the editor to
/dev/tty, so that it can restore terminal settings appropriately.

scripts/git-hooks/commit-msg

index bdea8c38d376bb893d73e08dd73c98687d643b12..05dce1ebb9d0cccbe9b2c94a1ce558cbc2e2c4d2 100755 (executable)
@@ -49,7 +49,7 @@ sub re_edit($)
 
   warn "Interrupt (Ctrl-C) to abort...\n";
 
-  system 'sh', '-c', "$editor $log_file";
+  system 'sh', '-c', "$editor $log_file </dev/tty >/dev/tty 2>&1";
   ($? & 127) || ($? >> 8)
     and die "$ME: $log_file: the editor ($editor) failed, aborting\n";
 }