Lines Matching +full:- +full:- +full:detach +full:- +full:sig
1 # subprocess - Subprocesses with accessible I/O streams
5 # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
23 ---------
106 returns a non-zero exit status.
121 self.cmd, signal.Signals(-self.returncode))
124 self.cmd, -self.returncode)
126 return "Command '%s' returned non-zero exit status %d." % (
201 def Detach(self): member in Handle
233 # [1] https://docs.microsoft.com/en-us/windows/desktop/ProcThread/
234 # creating-processes
259 PIPE = -1
260 STDOUT = -2
261 DEVNULL = -3
269 """Return a list of command-line arguments reproducing the current
274 args.append('-' + 'O' * value)
279 """Return a list of command-line arguments reproducing the current
290 # -O is handled in _optim_args_from_interpreter_flags()
296 args.append('-' + opt * v)
299 args.append('-I')
302 args.append('-E')
304 args.append('-s')
306 # -W options
319 args.append('-W' + opt)
321 # -X options
323 args.extend(('-X', 'dev'))
332 args.extend(('-X', arg))
343 retcode = call(["ls", "-l"])
362 check_call(["ls", "-l"])
376 If the exit code was non-zero it raises a CalledProcessError. The
382 >>> check_output(["ls", "-l", "/dev/null"])
383 b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
388 >>> check_output(["/bin/sh", "-c",
389 ... "ls -l non_existent_file ; exit 0"],
398 >>> check_output(["sed", "-e", "s/foo/bar/"],
454 """Raise CalledProcessError if the exit code is non-zero."""
468 If check is True and the exit code was non-zero, it raises a
556 # http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
558 # "Parsing C++ Command-Line Arguments"
606 return a 2-tuple (status, output). The locale encoding is used
621 (-15, '')
629 if data[-1:] == '\n':
630 data = data[:-1]
753 def __init__(self, args, bufsize=-1, executable=None,
760 encoding=None, errors=None, text=None, umask=-1, pipesize=-1):
766 # code must re-check self.returncode to see if another thread just
773 bufsize = -1 # Restore default
778 pipesize = -1 # Restore default
819 # ------ -----
820 # p2cwrite ---stdin---> p2cread
821 # c2pread <--stdout--- c2pwrite
822 # errread <--stderr--- errwrite
827 # are -1 when not using PIPEs. The child objects are -1
839 if p2cwrite != -1:
840 p2cwrite = msvcrt.open_osfhandle(p2cwrite.Detach(), 0)
841 if c2pread != -1:
842 c2pread = msvcrt.open_osfhandle(c2pread.Detach(), 0)
843 if errread != -1:
844 errread = msvcrt.open_osfhandle(errread.Detach(), 0)
867 bufsize = -1
949 if p2cwrite != -1:
955 if c2pread != -1:
960 if errread != -1:
1018 # compatibility. bpo-31756
1088 # bpo-19612, bpo-30418: On Windows, stdin.write() fails
1107 Read data from stdout and stderr, until end-of-file is
1184 return endtime - _time()
1231 if p2cread != -1:
1233 if c2pwrite != -1:
1235 if errwrite != -1:
1238 if p2cread != -1 and p2cwrite != -1 and p2cread != devnull_fd:
1240 if c2pwrite != -1 and c2pread != -1 and c2pwrite != devnull_fd:
1242 if errwrite != -1 and errread != -1 and errwrite != devnull_fd:
1260 return (-1, -1, -1, -1, -1, -1)
1262 p2cread, p2cwrite = -1, -1
1263 c2pread, c2pwrite = -1, -1
1264 errread, errwrite = -1, -1
1280 # Assuming file-like object
1298 # Assuming file-like object
1318 # Assuming file-like object
1371 raise TypeError('path-like args is not allowed when '
1384 # bpo-34044: Copy STARTUPINFO since it is modified above,
1388 use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
1548 def send_signal(self, sig): argument
1553 if sig == signal.SIGTERM:
1555 elif sig == signal.CTRL_C_EVENT:
1557 elif sig == signal.CTRL_BREAK_EVENT:
1560 raise ValueError("Unsupported signal: {}".format(sig))
1587 p2cread, p2cwrite = -1, -1
1588 c2pread, c2pwrite = -1, -1
1589 errread, errwrite = -1, -1
1602 # Assuming file-like object
1616 # Assuming file-like object
1626 if c2pwrite != -1:
1635 # Assuming file-like object
1663 if fd != -1:
1670 if fd != -1:
1697 raise TypeError('path-like args is not allowed when '
1707 args = [unix_shell, "-c"] + args
1722 and (p2cread == -1 or p2cread > 2)
1723 and (c2pwrite == -1 or c2pwrite > 2)
1724 and (errwrite == -1 or errwrite > 2)
1854 self.returncode = -_WSTOPSIG(sts)
1915 delay = 0.0005 # 500 us -> initial delay of 1 ms
2003 # XXX Rewrite these to use non-blocking I/O on the file
2061 def send_signal(self, sig): argument
2063 # bpo-38630: Polling reduces the risk of sending a signal to the
2088 os.kill(self.pid, sig)
2090 # Supress the race condition error; bpo-40550.