MCPcopy Create free account
hub / github.com/apache/impala / exec_local_command

Function exec_local_command

lib/python/impala_py_lib/helpers.py:27–47  ·  view source on GitHub ↗

Executes a command for the local bash shell and return stdout as a string. Raise CalledProcessError in case of non-zero return code. Args: cmd: command as a string Return: STDOUT

(cmd)

Source from the content-addressed store, hash-verified

25
26
27def exec_local_command(cmd):
28 """
29 Executes a command for the local bash shell and return stdout as a string.
30
31 Raise CalledProcessError in case of non-zero return code.
32
33 Args:
34 cmd: command as a string
35
36 Return:
37 STDOUT
38 """
39 proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE,
40 universal_newlines=True)
41 output, error = proc.communicate()
42 retcode = proc.poll()
43 if retcode:
44 LOG.error("{0} returned status {1}: {2}".format(cmd, retcode, error))
45 raise subprocess.CalledProcessError()
46 else:
47 return output
48
49
50def find_all_files(fname_pattern, base_dir=os.getenv('IMPALA_HOME', '.')):

Callers 1

is_core_dumpFunction · 0.85

Calls 4

communicateMethod · 0.80
pollMethod · 0.45
errorMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected