-
sh.scp(
"-i",
"my_key",
"a_file.tar.gz",
"[email protected]:/target/folder",
_out=sys.stdout, _err=sys.stderr,
) This will block until the file transfer is complete and not print anything. In case I add the special kwargs If I try to get hacky and try to adapt to https://sh.readthedocs.io/en/latest/tutorials/interacting_with_processes.html#tutorial2 like this: aggregated = ""
aggregated_stdout = ""
def print_stdout(char, stdin):
global aggregated_stdout
aggregated_stdout += char
if char == "\n" or "/s" in aggregated_stdout:
print(aggregated_stdout, end="")
aggregated_stdout = ""
aggregated_stderr = ""
def print_stderr(char, stdin):
global aggregated_stderr
aggregated_stderr += char
print(char, end="", file=sys.stderr)
sh.scp(
"-i",
"my_key",
"a_file.tar.gz",
"[email protected]:/target/folder",
_unify_ttys=True, _out=print_stdout, _err=print_stderr,
_out_bufsize=0, _tty_in=True,, _tty_out=True, _tee=("out", "err")
) Then I am pretty much getting what I want to see (the progress bar updating) but isnt there handling for such a scenario in sh? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
If you don't care about capturing the output, just use |
Beta Was this translation helpful? Give feedback.
@sla-te This is the second time you've expressed that us convincing you to use sh by helping you with your non-sh problems is actually aligned with our interests. It's not, and frankly we couldn't care less if you decided to use sh.
Unfortunately you have used up the remaining good will to help with whatever you are building. If you'd like to earn some of that good will back, you can make a PR with documentation improvements for the things that you figure out and would like to share with others. A good starting place might be a tutorial in the Tutorials Section
In the mean time, please don't make any more discussions.