mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	host: Fix PopenBackgroundCommand stdin
The Popen object created for background command currently has no stdin pipe, preventing the user from writing to it (it will be None instead of being a file-like object). Fix that by passing stdin=subprocess.PIPE to Popen constructor.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							47280f63da
						
					
				
				
					commit
					e231cb0849
				
			@@ -138,6 +138,7 @@ class LocalConnection(ConnectionBase):
 | 
			
		||||
            command,
 | 
			
		||||
            stdout=stdout,
 | 
			
		||||
            stderr=stderr,
 | 
			
		||||
            stdin=subprocess.PIPE,
 | 
			
		||||
            shell=True,
 | 
			
		||||
            preexec_fn=preexec_fn,
 | 
			
		||||
        )
 | 
			
		||||
 
 | 
			
		||||
@@ -600,7 +600,7 @@ def adb_background_shell(conn, command,
 | 
			
		||||
    adb_cmd = get_adb_command(device, 'shell', adb_server)
 | 
			
		||||
    full_command = '{} {}'.format(adb_cmd, quote(command))
 | 
			
		||||
    logger.debug(full_command)
 | 
			
		||||
    p = subprocess.Popen(full_command, stdout=stdout, stderr=stderr, shell=True)
 | 
			
		||||
    p = subprocess.Popen(full_command, stdout=stdout, stderr=stderr, stdin=subprocess.PIPE, shell=True)
 | 
			
		||||
 | 
			
		||||
    # Out of band PID lookup, to avoid conflicting needs with stdout redirection
 | 
			
		||||
    find_pid = '{} ps -A -o pid,args | grep {}'.format(conn.busybox, quote(uuid_var))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user