mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	connection: Add ParamikoBackgroundCommand.cmd attr for diagnostic
Add a "cmd" attribute for better exception messages.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							e231cb0849
						
					
				
				
					commit
					ad5a97afcc
				
			@@ -241,7 +241,7 @@ class ParamikoBackgroundCommand(BackgroundCommand):
 | 
			
		||||
    """
 | 
			
		||||
    :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.as_root = as_root
 | 
			
		||||
        self.conn = conn
 | 
			
		||||
@@ -250,6 +250,7 @@ class ParamikoBackgroundCommand(BackgroundCommand):
 | 
			
		||||
        self._stdout = stdout
 | 
			
		||||
        self._stderr = stderr
 | 
			
		||||
        self.redirect_thread = redirect_thread
 | 
			
		||||
        self.cmd = cmd
 | 
			
		||||
 | 
			
		||||
    def send_signal(self, sig):
 | 
			
		||||
        # If the command has already completed, we don't want to send a signal
 | 
			
		||||
 
 | 
			
		||||
@@ -591,6 +591,7 @@ class SshConnection(SshConnectionBase):
 | 
			
		||||
        return bg_cmd
 | 
			
		||||
 | 
			
		||||
    def _background(self, command, stdout, stderr, as_root):
 | 
			
		||||
        orig_command = command
 | 
			
		||||
        stdout, stderr, command = redirect_streams(stdout, stderr, command)
 | 
			
		||||
 | 
			
		||||
        command = "printf '%s\n' $$; exec sh -c {}".format(quote(command))
 | 
			
		||||
@@ -708,6 +709,7 @@ class SshConnection(SshConnectionBase):
 | 
			
		||||
            stdout=out_streams['stdout'][0],
 | 
			
		||||
            stderr=out_streams['stderr'][0],
 | 
			
		||||
            redirect_thread=redirect_thread,
 | 
			
		||||
            cmd=orig_command,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def _close(self):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user