runtime/spawn_subprocess.py
branchsvghmi
changeset 3293 d2b0c768755d
parent 2537 eb4a4cc41914
child 3750 f62625418bff
child 3860 a1d7187b8402
equal deleted inserted replaced
3292:ef04cedee08b 3293:d2b0c768755d
     5 
     5 
     6 from __future__ import print_function
     6 from __future__ import print_function
     7 from __future__ import absolute_import
     7 from __future__ import absolute_import
     8 import os
     8 import os
     9 import signal
     9 import signal
       
    10 import shlex
    10 import posix_spawn
    11 import posix_spawn
    11 
    12 
    12 PIPE = "42"
    13 PIPE = "42"
    13 
    14 
    14 
    15 
   102 
   103 
   103 def call(*args):
   104 def call(*args):
   104     cmd = []
   105     cmd = []
   105     if isinstance(args[0], str):
   106     if isinstance(args[0], str):
   106         if len(args) == 1:
   107         if len(args) == 1:
   107             # oversimplified splitting of arguments,
   108             # splitting of arguments that cares about 
   108             # TODO: care about use of simple and double quotes
   109             # use of simple and double quotes
   109             cmd = args[0].split()
   110             cmd = shlex.split(args[0])
   110         else:
   111         else:
   111             cmd = args
   112             cmd = args
   112     elif isinstance(args[0], list) and len(args) == 1:
   113     elif isinstance(args[0], list) and len(args) == 1:
   113         cmd = args[0]
   114         cmd = args[0]
   114     else:
   115     else: