sh
sh copied to clipboard
_tee supports only one of stderr or stdout
Ideally I'd like
-
sh.command(_err=callback, _out=callback, _tee=True)
to buffer both stderr and stdout -
sh.command(_err=callback, _out=callback, _tee=1)
to buffer both stderr and stdout -
sh.command(_err=callback, _out=callback, _tee=('err', 'out'))
to buffer both stderr and stdout -
sh.command(_err=callback, _out=callback, _tee=('err',))
to buffer stderr -
sh.command(_err=callback, _out=callback, _tee=('out',))
to buffer stdout
Of course this would make this an API breaking change 2.0.0?
I agree, I feel this is what you would intuitively expect given the inputs.
You can get both to work using:
class ErrOutStr(str):
'''A str that is in ('err',) and ('out',)'''
def __eq__(self, other):
return other in ('err', 'out')
_err_out_str = ErrOutStr()
def do_something_with_sh(...):
sh.command(_err=callback, _out=callback, _tee=_err_out_str)
Support for both "err" and "out" in _tee
is live in 2.0.0. It only took *checks date* 8 years 🤣 😭 ⏳