mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
connection: Add ParamikoBackgroundCommand.cmd attr for diagnostic
Add a "cmd" attribute for better exception messages.
This commit is contained in:
parent
e231cb0849
commit
ad5a97afcc
@ -241,7 +241,7 @@ class ParamikoBackgroundCommand(BackgroundCommand):
|
|||||||
"""
|
"""
|
||||||
:mod:`paramiko`-based background command.
|
:mod:`paramiko`-based background command.
|
||||||
"""
|
"""
|
||||||
def __init__(self, conn, chan, pid, as_root, stdin, stdout, stderr, redirect_thread):
|
def __init__(self, conn, chan, pid, as_root, cmd, stdin, stdout, stderr, redirect_thread):
|
||||||
self.chan = chan
|
self.chan = chan
|
||||||
self.as_root = as_root
|
self.as_root = as_root
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
@ -250,6 +250,7 @@ class ParamikoBackgroundCommand(BackgroundCommand):
|
|||||||
self._stdout = stdout
|
self._stdout = stdout
|
||||||
self._stderr = stderr
|
self._stderr = stderr
|
||||||
self.redirect_thread = redirect_thread
|
self.redirect_thread = redirect_thread
|
||||||
|
self.cmd = cmd
|
||||||
|
|
||||||
def send_signal(self, sig):
|
def send_signal(self, sig):
|
||||||
# If the command has already completed, we don't want to send a signal
|
# If the command has already completed, we don't want to send a signal
|
||||||
|
@ -591,6 +591,7 @@ class SshConnection(SshConnectionBase):
|
|||||||
return bg_cmd
|
return bg_cmd
|
||||||
|
|
||||||
def _background(self, command, stdout, stderr, as_root):
|
def _background(self, command, stdout, stderr, as_root):
|
||||||
|
orig_command = command
|
||||||
stdout, stderr, command = redirect_streams(stdout, stderr, command)
|
stdout, stderr, command = redirect_streams(stdout, stderr, command)
|
||||||
|
|
||||||
command = "printf '%s\n' $$; exec sh -c {}".format(quote(command))
|
command = "printf '%s\n' $$; exec sh -c {}".format(quote(command))
|
||||||
@ -708,6 +709,7 @@ class SshConnection(SshConnectionBase):
|
|||||||
stdout=out_streams['stdout'][0],
|
stdout=out_streams['stdout'][0],
|
||||||
stderr=out_streams['stderr'][0],
|
stderr=out_streams['stderr'][0],
|
||||||
redirect_thread=redirect_thread,
|
redirect_thread=redirect_thread,
|
||||||
|
cmd=orig_command,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _close(self):
|
def _close(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user