<s> import shutil <EOL> from subprocess import PIPE , DEVNULL <EOL> from app . util . log import get_logger <EOL> from app . util . process_utils import Popen_with_delayed_expansion <EOL> from app . util . shell . shell_client import ShellClient , Response , EmptyResponse <EOL> class LocalShellClient ( ShellClient ) : <EOL> def __init__ ( self , host , user ) : <EOL> super ( ) . __init__ ( host , user ) <EOL> self . _logger = get_logger ( __name__ ) <EOL> def _exec_command_on_client_async ( self , command ) : <EOL> """<STR_LIT>""" <EOL> self . _logger . debug ( '<STR_LIT>' . format ( self . user , self . host , command ) ) <EOL> Popen_with_delayed_expansion ( command , shell = True , stdout = DEVNULL , stderr = DEVNULL ) <EOL> return EmptyResponse ( ) <EOL> def _exec_command_on_client_blocking ( self , command ) : <EOL> """<STR_LIT>""" <EOL> proc = Popen_with_delayed_expansion ( command , shell = True , stdout = PIPE , stderr = PIPE ) <EOL> self . _logger . debug ( '<STR_LIT>' . format ( self . user , self . host , command ) ) <EOL> output , error = proc . communicate ( ) <EOL> return Response ( raw_output = output , raw_error = error , returncode = proc . returncode ) <EOL> def _copy_on_client ( self , source , destination ) : <EOL> """<STR_LIT>""" <EOL> new_location = shutil . copy ( source , destination ) <EOL> return Response ( raw_output = new_location . encode ( ) , returncode = <NUM_LIT:0> ) </s>
