-
Notifications
You must be signed in to change notification settings - Fork 149
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
Feature wanted: PTY support for interactive REPLs #655
Comments
Update: I installed rlwrap and it worked like a charm. It is now working as normal when I use the command Thank you! |
Hmm. I think that's because there's no TTY available for the command. Presumably some repls (I've tried I'm actually looking to add pseudo-ttys to watchexec in the future via https://lib.rs/crates/pty-process, though I wasn't coming at it from this angle, so that's more motivation to do so! |
I added some notes on experiments in #209. One more thing I just found and makes the current state much better: Running without (I would otherwise have a preference to run with |
hmmmm so i am launching a shell script (which implements a great deal of logic for how to handle watchexec events) from watchexec, which in turn launches my program which is a node.js script that serves a webserver. Because I found that it was not possible to convince watchexec on its own to properly terminate my node script the shell script implements a bunch of logic that boils down to sending a sigint to the process group of the node process, this works well for me. Now what I'm wanting is to be able to pipe stdin given to the watchexec/shellscript down into the node process. Which is actually being launched in the background. I think that means I'm looking at the same situation here, but I also think rlwrap on its own won't help me. I need a real pty here. Right? |
i realized once i switch to the json event stream execution mode instead of the program-capturing-env-var-providing execution mode, then it puts me in control over control flow, I can insert watching related logic into my app proper, and the above complexities will vanish. |
You can install watchexec from source from #699 it's essentially done, I just need to finish writing cross platform tests. That has the json-event-stream mode. |
I mean i think i already have it since you helped set me up with it the other day
|
Oh, very true. In any case, I plan on releasing 1.24.0 in the next half hour. |
Hi, thank you for watchexec! I was running into similar problems when trying to run watchexec -e py -r --no-process-group 'rlwrap --always-readline python3 -i script.py' This works both with or without
watchexec-python-i-clear-reset2.mp4Running without The input doesn't work at all if I leave out I hope this contains at least some useful information. I'm not sure if Python is using a pty or not. The output of Watchexec version is
rlwrap is version 0.46.1 Python is version 3.11.6. I'm using foot as the terminal emulator, on Fedora 38. |
That's correct Thanks for the detailed report! I've made early exploratory work into adding pty support to watchexec, and it's not as trivial as I originally thought, but will keep trying. |
FWIW I have been extremely satisfied with the JSON output only mode, in this mode the control flow is not inverted, which is a lot more natural for most applications. In this way, watchexec is only responsible for its main job of handling filesystem events, instead of providing an execution environment and all of the requisite complexities. We would need to manage the launching of watchexec and properly handle its output stream in this case. Of course, for general usability having both approaches available is ideal. |
I'm also working on a tool called |
very neat! yeah dealing with processes is always tricky. lately what i tend to do the most is node and between async/await and streams, it provides some good tools for manipulating processes and their output. I have been finding Typescript pretty ergonomic lately. But this does not feel very unixy. |
Watchexec 2.0.0 has |
Problem Description
When used with Haskell's Cabal like this:
watchexec -e --restart 'hs' 'cabal repl'
, the backspace fails to work.Expected
Using backspace would delete the last character.
Actual
Using backspace creates an escaped code
\?
Attempts
Using
-n
or--no-environment
didn't change this behaviour.If I remember correctly, this didn't happen with Scala's sbt in repl mode.
Misc
Watchexec's version:
watchexec 1.23.0 (2023-08-30)
build-date: 2023-08-30
release: 1.23.0
features:
The OS you're using:
macOS 13.5.2
A log with
-vvv --log-file
https://gist.github.com/leana8959/6d7afb8d892d5138eac4349bba7c51ae
Thank you for the help, have a nice day :)
The text was updated successfully, but these errors were encountered: