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

handle interactive commands #49

Open
michaelneale opened this issue Sep 6, 2024 · 1 comment · May be fixed by #66
Open

handle interactive commands #49

michaelneale opened this issue Sep 6, 2024 · 1 comment · May be fixed by #66
Assignees

Comments

@michaelneale
Copy link
Collaborator

goose will often appear to hang when it runs something that is an interactive command - would be nice to detect this and either return to the user or have it explore other ways to invoke the tool (via help).

the trick is to know it is hung waiting on user input I think?

@michaelneale
Copy link
Collaborator Author

thoughts: could be something like

import subprocess
import select

# Start a subprocess that runs a shell command
process = subprocess.Popen(['your_command'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# Use select to monitor the process's stdin
ready_to_read, _, _ = select.select([process.stdin], [], [], timeout=1)

if not ready_to_read:
    print("Process is waiting for input or idle.")
else:
    print("Process is actively doing something.")

@michaelneale michaelneale self-assigned this Sep 17, 2024
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

Successfully merging a pull request may close this issue.

1 participant