(mode, file, args, env, func)
| 890 | # as execv*()? |
| 891 | |
| 892 | def _spawnvef(mode, file, args, env, func): |
| 893 | # Internal helper; func is the exec*() function to use |
| 894 | if not isinstance(args, (tuple, list)): |
| 895 | raise TypeError('argv must be a tuple or a list') |
| 896 | if not args or not args[0]: |
| 897 | raise ValueError('argv first element cannot be empty') |
| 898 | pid = fork() |
| 899 | if not pid: |
| 900 | # Child |
| 901 | try: |
| 902 | if env is None: |
| 903 | func(file, args) |
| 904 | else: |
| 905 | func(file, args, env) |
| 906 | except: |
| 907 | _exit(127) |
| 908 | else: |
| 909 | # Parent |
| 910 | if mode == P_NOWAIT: |
| 911 | return pid # Caller is responsible for waiting! |
| 912 | while 1: |
| 913 | wpid, sts = waitpid(pid, 0) |
| 914 | if WIFSTOPPED(sts): |
| 915 | continue |
| 916 | |
| 917 | return waitstatus_to_exitcode(sts) |
| 918 | |
| 919 | def spawnv(mode, file, args): |
| 920 | """spawnv(mode, file, args) -> integer |
no test coverage detected