Process.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
5 
17 
18 import os,sys
19 import traceback
20 import subprocess
21 
22 
30 def launch_shell(command):
31  args = command.split(" ")
32 
33  if sys.platform == "win32":
34  CREATE_NEW_PROCESS_GROUP = 0x00000200
35  subproc_args = { 'stdin': None,
36  'stdout': None,
37  'stderr': None,
38  'cwd': None,
39  'close_fds': False,
40  'creationflags': CREATE_NEW_PROCESS_GROUP}
41  else:
42  subproc_args = { 'stdin': None,
43  'stdout': None,
44  'stderr': None,
45  'cwd': None,
46  'close_fds': False,
47  'preexec_fn': os.setsid}
48 
49  try:
50  p = subprocess.Popen(args, **subproc_args)
51  except OSError:
52  # fork failed
53  if sys.version_info[0:3] >= (2, 4, 0):
54  print traceback.format_exc()
55  else:
56  _exc_list = traceback.format_exception(*sys.exc_info())
57  print "".join(_exc_list)
58 
59  return -1
60  return 0
61 
def launch_shell(command)
Launching a processint launch_shell(std::string command)
Definition: Process.py:30


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34