def execCmd(cmd,
timeOut = -1):
"""
Execute the command given on the UNIX command line and returns a
list with the cmd exit code and the output written on stdout and stderr.
cmd: Command to execute on the shell (string).
timeOut: Timeout waiting for the command. A timeout of "-1" means
that no timeout is applied (float).
Returns: Tuple with the exit code and output on stdout and stderr:
[<exit code>, <stdout>]
"""
logger.debug("Executing command: %s", cmd)
if (timeOut == -1):
return commands.getstatusoutput(cmd)
else:
exitCode, stdout, stderr = ngamsCoreExecCmd(cmd, timeOut)
return [exitCode, stdout]
评论列表
文章目录