Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import os,sys
00019 import traceback
00020 import subprocess
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 def launch_shell(command):
00031 args = command.split(" ")
00032
00033 if sys.platform == "win32":
00034 CREATE_NEW_PROCESS_GROUP = 0x00000200
00035 subproc_args = { 'stdin': None,
00036 'stdout': None,
00037 'stderr': None,
00038 'cwd': None,
00039 'close_fds': False,
00040 'creationflags': CREATE_NEW_PROCESS_GROUP}
00041 else:
00042 subproc_args = { 'stdin': None,
00043 'stdout': None,
00044 'stderr': None,
00045 'cwd': None,
00046 'close_fds': False,
00047 'preexec_fn': os.setsid}
00048
00049 try:
00050 p = subprocess.Popen(args, **subproc_args)
00051 except OSError:
00052
00053 if sys.version_info[0:3] >= (2, 4, 0):
00054 print traceback.format_exc()
00055 else:
00056 _exc_list = traceback.format_exception(*sys.exc_info())
00057 print "".join(_exc_list)
00058
00059 return -1
00060 return 0
00061