MCPcopy Create free account
hub / github.com/comaps/comaps / _run_system_unsafe

Method _run_system_unsafe

tools/python/routing/src/utils.py:107–125  ·  view source on GitHub ↗
(self, *, cmd, env=None, output_file=None, log_cmd=False)

Source from the content-addressed store, hash-verified

105 return dt.strftime('%Y_%m_%d__%H_%M_%S')
106
107 def _run_system_unsafe(self, *, cmd, env=None, output_file=None, log_cmd=False):
108 env_params = ""
109 if env is None:
110 env = dict()
111 else:
112 env_params = "env "
113
114 for key, value in env.items():
115 env_params += f'{key}={value} '
116
117 if output_file is None:
118 output = ""
119 else:
120 output = f'> {output_file} 2>&1'
121
122 full_cmd = env_params + cmd + output
123 if log_cmd:
124 LOG.info(f'Run: {full_cmd}')
125 return {os.system(full_cmd), full_cmd}
126
127 def _run_system(self, *, cmd, env=None, output_file=None, log_cmd=False):
128 result, full_cmd = self._run_system_unsafe(cmd=cmd, env=env, output_file=output_file, log_cmd=log_cmd)

Callers 2

_run_systemMethod · 0.95
runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected