Open jakul opened 6 years ago
I've just checked the docs and found out that I shouldn't use command.err
with non-blocking mode. Maybe the correct fix for this bug it so update the err
function to not even try to read the error streams in non-blocking mode?
Closing due to inactivity :+1:
I'm re-opening this because there is actually a PR for it.
@jakul I think #62 fixed your issue, too. Can you please double check?
@timofurrer The behaviour is better, but still not correct.
In [1]: import delegator
In [2]: command = delegator.run('echo a', block=False)
In [3]: command.err
Out[3]: 'a\n'
In [4]: command.err
Out[4]: 'a\n'
In [5]: command.err
Out[5]: ''
In [6]: command.err
Out[6]: ''
Now command.err
has a different the first and second times I call it, compared to the 3rd, 4th etc.
It's any ways strange that you get an output at all for command.err
.
It seems to work fine when you try to get the stdout from command.out
.
I've just commited https://github.com/kennethreitz/delegator.py/commit/ad67b14232cd54a36b60afc6b02a3e8a1e75cca2 with which command.err
is cached properly, but doesn't actually return stderr but stdout (which was already the case before this change. I'll have a look at how to change that behavior, too)
Accessing
command.err
a second time causes an exceptionThe cause is that
self.subprocess.after
becomes<class 'pexpect.exceptions.EOF'>
after the firstcommand.err