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

pexpect.spawn hangs when cwd is used but the directory doesn't exist #757

Open
jsolbrig opened this issue May 24, 2023 · 0 comments
Open

Comments

@jsolbrig
Copy link

I ran into an issue where I was calling pexpect.spawn with the cwd keyword, but had forgotten to create the directory referenced by that keyword. When called, the process just hangs, even if timeout is set.

For example, this appears to hang indefinitely:

import pexpect
proc = pexpect.spawn("ls -la", cwd="./does_not_exist", timeout=1)

This works as expected:

import os, pexpect
os.mkdirs("./exists")
proc = pexpect.spawn("ls -la", cwd="./exists", timeout=1)
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

1 participant