From c2a2f87f4c7df5c034432a2bab0d2a024e9575a3 Mon Sep 17 00:00:00 2001 From: mundifex Date: Thu, 25 Mar 2021 22:51:56 -0500 Subject: [PATCH] Fix deadlock in stash levels - use vertical tab character instead of "MAGIC" string to denote end of input - check for terminator using pattern match instead of eq Users are unable to provide special characters to Bash process so this should be relatively safe. Pattern match succeeds even when `git stash` omits newline while rendering commit subjects. Fixes git-learning-game/oh-my-git#56 --- scripts/net-test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/net-test b/scripts/net-test index 0bfbcf5..2b3d9d8 100755 --- a/scripts/net-test +++ b/scripts/net-test @@ -34,12 +34,12 @@ while(true) { STDOUT->flush(); $s = ""; - $command = $s2 . "\necho MAGIC\n"; + $command = $s2 . "\necho -e \"\\v\"\n"; print $in $command; inner_while: while (true) { $line = <$out>; - if ($line eq "MAGIC\n") { + if ($line =~ s/\cK//) { STDOUT->flush(); last inner_while; }