The docstring of the Runner's run method state the following about the stdin= parameter:
|
stdin : file-like, string, bytes, Queue, or None |
|
If stdin is a file-like, it will be directly used as stdin for the |
|
subprocess. The caller is responsible for writing to it and closing it. |
|
If stdin is a string or bytes, those will be fed to stdin of the |
|
subprocess. If all data is written, stdin will be closed. |
|
If stdin is a Queue, all elements (bytes) put into the Queue will |
|
be passed to stdin until None is read from the queue. If None is read, |
|
stdin of the subprocess is closed. |
However, if I provide a string to it (I tried toying around in the context of #6514), I get
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/home/adina/repos/datalad/datalad/runner/runnerthreads.py", line 172, in run
succeeded = self.write(data)
File "/home/adina/repos/datalad/datalad/runner/runnerthreads.py", line 246, in write
written += os.write(
TypeError: a bytes-like object is required, not 'str'
I feel like I might be missing something fairly obvious. How can I provide a string as stdin to a runner.run() call?
The docstring of the Runner's run method state the following about the
stdin=parameter:datalad/datalad/runner/runner.py
Lines 91 to 98 in 66a8b77
However, if I provide a string to it (I tried toying around in the context of #6514), I get
I feel like I might be missing something fairly obvious. How can I provide a string as stdin to a
runner.run()call?