IceCube has asked for the wisdom of the Perl Monks concerning the following question:

Hey guys, I am new to Perl and I have been trying hard to capture the progress of the scp command from my perl script..When we run hte scp command from the command prompt it displays the transfer progress. But when I run the same command from my Perl script using the system command or the backticks, I cant capture the progress. Actually I have a Java GUI that calls this perl script to transfer the file to a server. Can someone tell me what would be the best way to capture the progress and show it in the GUI? Any help / suggestion is greatly appreciated ! thanks.
  • Comment on Help capturing progress of scp command from Perl

Replies are listed 'Best First'.
Re: Help capturing progress of scp command from Perl
by dsheroh (Monsignor) on Jun 23, 2006 at 15:02 UTC
    One possibility is that scp may be testing whether stdin/stdout are connected to a tty device. Your program isn't a tty, so scp could be deciding not to output progress information because it won't be seen anyhow.

    If this is the case, you should be able to work around it by using Expect to run scp via a pseudo-tty (ptty).

    Again, though, this is hypothetical. scp could be refusing to cooperate for a completely different reason, in which case this won't make any difference, but it's what I would try first if I were in your position.

Re: Help capturing progress of scp command from Perl
by ww (Archbishop) on Jun 23, 2006 at 15:00 UTC
    So, help us to help you.
    1. Read How do I post a question effectively?
    2. Search -- for, oh, say "progress bar"
    3. Super search
    4. Show us code
    5. Specify what's happening/not happening that you expected;
      ...yeah, yeah, you "sorta'" did, but not unambiguously
    and, welcome to the Monastery.

    BTW, do you rap?

      thanks for your help..