0

When I run a remote command over ssh that includes a progress bar (like phpunit or wget) instead of getting a progress bar that updates, I get repeated stdout bars that stack:

 $ ssh user1@server1 some_command

 -------------------------------
 ##-----------------------------
 ######-------------------------
 #######------------------------
 ###########--------------------
 ##############-----------------
 ########################-------
 etc

Is there any command I can run/pipe that will re-render these lines over the previous one (so the bar works as though I were running the command locally)?

willoller
  • 7,106
  • 1
  • 35
  • 63
  • apparently your local terminal doesn't support the control characters the remote program sues to overrite the lines. – Johannes H. Jul 23 '14 at 20:04
  • Try forcing pseudo-tty allocation with `-t`? – Etan Reisner Jul 23 '14 at 20:05
  • if I ssh in and run the command as the local user it runs fine - something about running the command remotely (without directly using a session on the server) appears to be different. Any ideas how to figure out what is different? – willoller Jul 23 '14 at 20:05

1 Answers1

0

The command is using features of an ANSI terminal (control sequences) to render the progress bar. A well written program that is using these control chars, will check if it's output goes to an interactive terminal before using them. This is because if the output of the program is not going to an interactive terminal like a pipe (or socket via ssh), the control sequences would normally mess the ouput.

The libc defines the function isatty() for that check, I bet the program is using it.

Some time ago I wrote an answer that shows how to trick the program with a customized isatty() function, linked using LD_PRELOAD before the libc, let me find that again ....

... here it is Bash: trick program into thinking stdout is an interactive terminal

Community
  • 1
  • 1
hek2mgl
  • 152,036
  • 28
  • 249
  • 266