wexpect
wexpect copied to clipboard
logfile parameter not working in version 4.0.0
Describe the bug It seems that logfile parameter in wexpect.host.SpawnPipe does not work
To Reproduce
import wexpect
f = open("test.txt","w")
child = wexpect.spawn("cmd.exe",encoding="UTF-8",logfile=f)
child.expect(">")
child.send("dir")
child.sendeof()
f.close()
Expected behavior command output should be written to logfile open the file after running script only to get a blank logfile
Environment:
- Windows 10
- Python 3.10
- wexpect 4.0.0
Reproduced. I went though a few of the spawn classes and the logfile argument is actually not used. I am unsure what this argument should be. I think allowing passing on a object would not be easy.
Would it be acceptable to just pass on the name of the file? Then it can just update os.environ['WEXPECT_LOGGER_FILENAME'] and respawn the logger and then it should be good.
@raczben Do you have an opinion on this?