MCPcopy Create free account
hub / github.com/apache/cloudstack / run_cmd

Function run_cmd

systemvm/debian/opt/cloud/bin/diagnostics.py:24–39  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

22
23
24def run_cmd(command):
25 if command is not None:
26 try:
27 p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
28 stdout, stderr = p.communicate()
29 return_code = p.returncode
30
31 except OSError as e:
32 stdout = "Check your command type"
33 stderr = "Exception occurred: %s" % e
34 return_code = 1
35
36 finally:
37 print('%s&&' % stdout.decode().strip())
38 print('%s&&' % stderr.decode().strip())
39 print('%s' % return_code)
40
41
42def get_command():

Callers 2

diagnostics.pyFile · 0.85
cdBootMethod · 0.85

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected