MCPcopy Create free account
hub / github.com/pyinvoke/invoke / _write_proc_stdin

Method _write_proc_stdin

invoke/runners.py:1303–1321  ·  view source on GitHub ↗
(self, data: bytes)

Source from the content-addressed store, hash-verified

1301 return None
1302
1303 def _write_proc_stdin(self, data: bytes) -> None:
1304 # NOTE: parent_fd from os.fork() is a read/write pipe attached to our
1305 # forked process' stdout/stdin, respectively.
1306 if self.using_pty:
1307 fd = self.parent_fd
1308 elif self.process and self.process.stdin:
1309 fd = self.process.stdin.fileno()
1310 else:
1311 raise SubprocessPipeError(
1312 "Unable to write to missing subprocess or stdin!"
1313 )
1314 # Try to write, ignoring broken pipes if encountered (implies child
1315 # process exited before the process piping stdin to us finished;
1316 # there's nothing we can do about that!)
1317 try:
1318 os.write(fd, data)
1319 except OSError as e:
1320 if "Broken pipe" not in str(e):
1321 raise
1322
1323 def close_proc_stdin(self) -> None:
1324 if self.using_pty:

Callers

nothing calls this directly

Calls 2

SubprocessPipeErrorClass · 0.85
strClass · 0.85

Tested by

no test coverage detected