mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	host: Concatenate stdout and stderr from command output
Previously any output from stderr was discarded for LocalTargets. Align the behaviour of `execute` to append any stderr output to stdout before returning.
This commit is contained in:
		@@ -104,7 +104,7 @@ class LocalConnection(ConnectionBase):
 | 
			
		||||
            command = 'echo {} | sudo -S -- sh -c '.format(quote(password)) + quote(command)
 | 
			
		||||
        ignore = None if check_exit_code else 'all'
 | 
			
		||||
        try:
 | 
			
		||||
            return check_output(command, shell=True, timeout=timeout, ignore=ignore)[0]
 | 
			
		||||
            stdout, stderr = check_output(command, shell=True, timeout=timeout, ignore=ignore)
 | 
			
		||||
        except subprocess.CalledProcessError as e:
 | 
			
		||||
            message = 'Got exit code {}\nfrom: {}\nOUTPUT: {}'.format(
 | 
			
		||||
                e.returncode, command, e.output)
 | 
			
		||||
@@ -112,6 +112,7 @@ class LocalConnection(ConnectionBase):
 | 
			
		||||
                raise TargetTransientError(message)
 | 
			
		||||
            else:
 | 
			
		||||
                raise TargetStableError(message)
 | 
			
		||||
        return stdout + stderr
 | 
			
		||||
 | 
			
		||||
    def background(self, command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, as_root=False):
 | 
			
		||||
        if as_root and not self.connected_as_root:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user