Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logfile parameter not working in version 4.0.0 #55

Open
Rexoen opened this issue Aug 22, 2022 · 1 comment
Open

logfile parameter not working in version 4.0.0 #55

Rexoen opened this issue Aug 22, 2022 · 1 comment

Comments

@Rexoen
Copy link

Rexoen commented Aug 22, 2022

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
@Stefanhg
Copy link

Stefanhg commented Oct 1, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants