Browse Source

Force svn export through pseudo-tty for live progress

cere 1 tháng trước cách đây
mục cha
commit
28ccaeaa93
1 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 10 2
      svn_interact/svn_git_init

+ 10 - 2
svn_interact/svn_git_init

@@ -7,11 +7,19 @@ echo "Exporting SVN working copy to $DEST (versioned files only)..."
 rm -rf -- "$DEST"
 count=0
 start_ts="$(date +%s.%N)"
-if command -v stdbuf >/dev/null 2>&1; then
+if command -v script >/dev/null 2>&1; then
+  # script(1) forces a pseudo-tty so svn flushes output immediately
+  export_cmd=(script -q -c "svn export . \"$DEST\"" /dev/null)
+elif command -v stdbuf >/dev/null 2>&1; then
   export_cmd=(stdbuf -o0 -e0 svn export . "$DEST")
-  awk_cmd=(stdbuf -o0 awk -v start="$start_ts")
 else
   export_cmd=(svn export . "$DEST")
+fi
+
+# Keep awk unbuffered too
+if command -v stdbuf >/dev/null 2>&1; then
+  awk_cmd=(stdbuf -o0 awk -v start="$start_ts")
+else
   awk_cmd=(awk -W interactive -v start="$start_ts")
 fi