8000 Get verbose output from put/get ? · Issue #44 · jbardin/scp.py · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Get verbose output from put/get ? #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mattmaniflaf opened this issue Jan 9, 2015 · 5 comments
Open

Get verbose output from put/get ? #44

mattmaniflaf opened this issue Jan 9, 2015 · 5 comments

Comments

@mattmaniflaf
Copy link

Current put() method executes "scp -t " on remote server and receives file then being sent via chan.sendall() over the channel.

I'm getting intermittent failures and I'd like to get verbose output from scp to help trace issue. I can manually change scp.py to execute "scp -v -t " however no idea where the stdout is being sent to ?

Any ideas ?

@remram44
Copy link
Collaborator
remram44 commented Jan 9, 2015

The lib will read stderr on some occasions, passing it as argument to raised SCPExceptions, but otherwise the error output is not read. In fact, having the scp command print out verbose output could fill the receive buffer and freeze paramiko.

I'm trying to find a way for paramiko to log the stderr it gets, but there doesn't seem to be anything built in.

@nanomosfet
Copy link
Contributor
nanomosfet commented Jan 23, 2018

So from the docs explaining the paramiko.client.SSHClient

Reads

client = SSHClient()
client.load_system_host_keys()
client.connect('ssh.example.com')
stdin, stdout, stderr = client.exec_command('ls -l')

I'm wondering if to solve this issue is it a simple fix of doing

def put and get
...

-    self.channel.exec_command(scp_command +
-                                  self.sanitize(asbytes(remote_path)))
+    stdin, stdout, stderr = self.channel.exec_command(scp_command +
+                                  self.sanitize(asbytes(remote_path)))

...

If you think that is an appropriate solution then let me know and I can make a pull request!

@remram44
Copy link
Collaborator
remram44 commented Jan 23, 2018

This will give you pseudo-files you can read from instead of reading from the channel directly, but I'm no sure how it fixes the problem. PR welcome if you want to take a crack at it.

@nanomosfet
Copy link
Contributor

@remram44 yeah I see what you are saying. The pseudo files can only be read after the exec_command finishes which doesn't really give us an up to date stdin.

@remram44
Copy link
Collaborator
remram44 commented Jan 23, 2018

The pseudo files can only be read after the exec_command finishes

No that is not the case. I'm saying there's no difference doing stderr.read() over the current channel.recv_stderr().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0