Lines Matching +full:- +full:- +full:stdin
1 # subprocess - Subprocesses with accessible I/O streams
5 # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
28 ---------
46 check_output() returns a non-zero exit status.
56 return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
118 PIPE = -1
119 STDOUT = -2
137 """Return a list of command-line arguments reproducing the current
156 args.append('-' + opt * v)
158 args.append('-R')
160 args.append('-W' + opt)
170 retcode = call(["ls", "-l"])
183 check_call(["ls", "-l"])
197 If the exit code was non-zero it raises a CalledProcessError. The
203 >>> check_output(["ls", "-l", "/dev/null"])
204 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
209 >>> check_output(["/bin/sh", "-c",
210 ... "ls -l non_existent_file ; exit 0"],
254 # http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
256 # "Parsing C++ Command-Line Arguments"
306 creating the stdin/stdout/stderr pipe file objects
310 stdin, stdout and stderr: These specify the executed programs' standard
325 objects stdin, stdout and stderr.
330 stdin, stdout, stderr, pid, returncode
335 stdin=None, stdout=None, stderr=None, argument
349 if close_fds and (stdin is not None or stdout is not None or
352 "platforms if you redirect stdin/stdout/stderr")
362 self.stdin = None
373 # ------ -----
374 # p2cwrite ---stdin---> p2cread
375 # c2pread <--stdout--- c2pwrite
376 # errread <--stderr--- errwrite
386 errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
419 self.stdin = os.fdopen(p2cwrite, 'wb', bufsize)
453 """Interact with process: Send data to stdin. Read data from
454 stdout and stderr, until end-of-file is reached. Wait for
463 if [self.stdin, self.stdout, self.stderr].count(None) >= 2:
466 if self.stdin:
469 self.stdin.write(input)
473 self.stdin.close()
496 def _get_handles(self, stdin, stdout, stderr): argument
501 if stdin is None and stdout is None and stderr is None:
508 if stdin is None:
512 elif stdin == PIPE:
514 elif isinstance(stdin, (int, long)):
515 p2cread = msvcrt.get_osfhandle(stdin)
517 # Assuming file-like object
518 p2cread = msvcrt.get_osfhandle(stdin.fileno())
522 if stdin == PIPE:
534 # Assuming file-like object
553 # Assuming file-like object
579 # Eeek - file-not-found - possibly an embedding
580 # situation - see if we can locate it in sys.exec_prefix
719 if self.stdin:
722 self.stdin.write(input)
728 # bpo-19612, bpo-30418: On Windows, stdin.write()
735 self.stdin.close()
794 def _get_handles(self, stdin, stdout, stderr): argument
803 if stdin is None:
805 elif stdin == PIPE:
808 elif isinstance(stdin, (int, long)):
809 p2cread = stdin
811 # Assuming file-like object
812 p2cread = stdin.fileno()
822 # Assuming file-like object
838 # Assuming file-like object
893 # user of a --without-threads build.
914 args = ["/bin/sh", "-c"] + args
933 # Disable gc to avoid bug where gc -> file_dealloc ->
934 # write to stderr -> hang.
968 # would be a no-op (issue #10806).
991 # Close all other fds, if asked for - after
1057 self.returncode = -_WTERMSIG(sts)
1061 self.returncode = -_WSTOPSIG(sts)
1116 if self.stdin:
1118 # been writing to .stdin in an uncontrolled fashion.
1119 self.stdin.flush()
1121 self.stdin.close()
1164 if self.stdin and input:
1165 register_and_append(self.stdin, select.POLLOUT)
1215 if self.stdin and input:
1216 write_set.append(self.stdin)
1233 if self.stdin in wlist:
1236 bytes_written = os.write(self.stdin.fileno(), chunk)
1239 self.stdin.close()
1240 write_set.remove(self.stdin)
1246 self.stdin.close()
1247 write_set.remove(self.stdin)
1302 p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
1329 p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE)