(mode, file, args, env, func)
| 909 | # as execv*()? |
| 910 | |
| 911 | def _spawnvef(mode, file, args, env, func): |
| 912 | # Internal helper; func is the exec*() function to use |
| 913 | if not isinstance(args, (tuple, list)): |
| 914 | raise TypeError('argv must be a tuple or a list') |
| 915 | if not args or not args[0]: |
| 916 | raise ValueError('argv first element cannot be empty') |
| 917 | pid = fork() |
| 918 | if not pid: |
| 919 | # Child |
| 920 | try: |
| 921 | if env is None: |
| 922 | func(file, args) |
| 923 | else: |
| 924 | func(file, args, env) |
| 925 | except: |
| 926 | _exit(127) |
| 927 | else: |
| 928 | # Parent |
| 929 | if mode == P_NOWAIT: |
| 930 | return pid # Caller is responsible for waiting! |
| 931 | while 1: |
| 932 | wpid, sts = waitpid(pid, 0) |
| 933 | if WIFSTOPPED(sts): |
| 934 | continue |
| 935 | |
| 936 | return waitstatus_to_exitcode(sts) |
| 937 | |
| 938 | def spawnv(mode, file, args): |
| 939 | """spawnv(mode, file, args) -> integer |
no test coverage detected
searching dependent graphs…