-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
interactive clients tend not to launch in poe #64
Comments
Maybe we could use pexpect for spawning stuff. It’s used by Poetry for the Footnotes |
oh! I like that idea a lot! LMK if you need anything.
Happy to be the guinea pig.
…On Sun, May 8, 2022 at 7:58 AM ThatXliner ***@***.***> wrote:
Maybe we could use pexpect for spawning stuff. It’s used by Poetry for the poetry
shell command1
<#m_2283887485365752810_user-content-fn-1-798dff1aa6cc696e0eec2afc473e74c4>.
Here’s an example of pexpect:
https://github.com/pexpect/pexpect/blob/master/examples/python.py
Footnotes
1.
https://github.com/python-poetry/poetry/blob/4838c9fe9645c62353be569a96765c693f03f1a3/src/poetry/utils/shell.py#L71
↩
<#m_2283887485365752810_user-content-fnref-1-798dff1aa6cc696e0eec2afc473e74c4>
—
Reply to this email directly, view it on GitHub
<#64 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABEBE6XKPJ6KJYH3RVLVX6DVI7JBTANCNFSM5VLPP4XA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi @gangofnuns, thanks for the feedback. I've encountered similar issues with this myself, but haven't quite gotten to the bottom of it. What I know is that the following does give you an interactive REPL as expected: [tool.poe.tasks.repl]
cmd = "python" and the same works for script tasks: # tasks.py
def repl():
while True:
print(eval(input(">>> "))) # pyproject.toml
[tool.poe.tasks.repl]
script = "tasks:repl" But it doesn't work for shell tasks: [tool.poe.tasks.repl]
shell = "tasks:repl" This is because shell tasks work by passing the task content into the shell executable via stdin – which is the most reliable cross shell/platform method I'm aware of, but does rule out directly interacting with processes inside the child shell via the terminal. Are you encountering this issue specifically with shell tasks or is there something about some other tool that works differently with cmd tasks as well? @ThatXliner I guess pexpect works by using a background thread to manage communication with the shell subprocess? I wouldn't rule out adopting it as an option for shell tasks specifically, though it's quite heavy weight and a bit complex, so I'm a little hesitant. I'd like to better understand the use cases and how this stuff works before committing to such an approach. |
I worked around this issue by using eg:
|
Thanks -- very kind of you to point out. :0) I will give this a try!
Cheers --
…On Wed, Jun 15, 2022 at 6:48 AM Jonathan Liuti ***@***.***> wrote:
I worked around this issue by using command instead of shell.
[tool.poe.tasks.interactive_command]
cmd = "bash -c interactive-command"
—
Reply to this email directly, view it on GitHub
<#64 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABEBE6XP7IY2C74ZG4TV7CLVPHNK5ANCNFSM5VLPP4XA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
You can also use an expression task and [tool.poe.tasks.interactive]
# Do not raise an exception if the command fails,
# just pass on its exit code.
expr = '''
sys.exit(subprocess.run(
["vim", "pyproject.toml"]
).returncode)
'''
imports = ["subprocess", "sys"] |
I had the same issue - shell= a shell script that ran aws s3 sync in dryrun then asks if you wish to proceed. It would break at the "read -p" of the script. @johnraz 's solution to:
Worked. |
Hello --
I've been using poe to launch a few console tools written in shell recently.
It works!
However, I've noticed that when I run interactive tools like mysql or psql clients,
it fails to launch them, even in simple scenarios.
Is this a known issue? Curious if there might be a workaround.
Thanks for the tools! Cheers --
The text was updated successfully, but these errors were encountered: