git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix cg-patch hanging on terminals with TOSTOP flag
@ 2006-05-25  1:40 Pavel Roskin
  2006-05-25  1:40 ` [PATCH 2/2] Improve the tutorial script Pavel Roskin
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2006-05-25  1:40 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

From: Pavel Roskin <proski@gnu.org>

Terminals with TOSTOP flag don't allow background processes to write to
the terminal.  This flag is used e.g. by the subshell in GNU Midnight
Commander.  It can also be set by "stty tostop".

Redirect stdout and strerr of the "patch" command to a temporary file
and show it once "patch" terminates.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 cg-patch |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cg-patch b/cg-patch
index 9ea7de4..115869e 100755
--- a/cg-patch
+++ b/cg-patch
@@ -337,6 +337,7 @@ # parts of the tree from inadverent poll
 [ "$unidiff" ] && newsfile="$(mktemp -t gitapply.XXXXXX)"
 gonefile="$(mktemp -t gitapply.XXXXXX)"
 todo="$(mktemp -t gitapply.XXXXXX)"
+patchout="$(mktemp -t gitapply.XXXXXX)"
 patchfifo="$(mktemp -t gitapply.XXXXXX)"
 rm "$patchfifo" && mkfifo -m 600 "$patchfifo"
 
@@ -347,7 +348,7 @@ # patch file removal behaviour cannot be
 # just handle it all ourselves.
 patch_args="-p$strip -N"
 [ "$reverse" ] && patch_args="$patch_args -R"
-patch $patch_args <"$patchfifo" &
+patch $patch_args <"$patchfifo" >"$patchout" 2>&1 &
 
 tee "$patchfifo" | {
 	redzone_reset
@@ -407,6 +408,7 @@ tee "$patchfifo" | {
 } >$todo
 
 wait %1; ret=$?
+cat "$patchout"
 
 IFS=$'\n' emptyfiles=($(git-ls-files --deleted | join -v 2 "$gonefile" -))
 if [ "$unidiff" ]; then
@@ -441,7 +443,7 @@ while [ "$1" ]; do
 done
 ' padding
 
-rm "$patchfifo" "$todo" "$gonefile"
+rm "$patchfifo" "$todo" "$gonefile" "$patchout"
 [ "$unidiff" ] && rm "$newsfile"
 
 exit $ret

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-25  1:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-25  1:40 [PATCH 1/2] Fix cg-patch hanging on terminals with TOSTOP flag Pavel Roskin
2006-05-25  1:40 ` [PATCH 2/2] Improve the tutorial script Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).