I’m trying to execute
vim (or any interactive commandline program/editor) from rust but that leaves the terminal trashed… I’m not sure how to do it properly (I’m sure it can be done).
My setup is a bit unusual, so I’ll explain it here:
- User executes
echo foo | imag edit -I
imagbinary finds “edit” as command and executes
imag-edit, passing all parameters
-Iparameter which means it should read the path of the file to edit from stdin
imag-editreads from stdin. It reads
some/path/foo, copies its content to a temporary file
vimon that temporary file
- after vim is closed,
imag-editreads the temp file and writes its contents back to the original file.
Somewhere in this process something works not as intended and vim leaves the terminal trashed.
Commandbuilding in the
imagbinary is located here
Commandbuilding for the editor is located here (if I change the stdin to be inherited, that does not help and the same trashing of terminal happens)
imag-editreading from commandline is located here
- The calling of the editor command is located here
I’m not sure what the actual issue is. I inherit
stdin everywhere (if I do it in libimagrt it does not work either, as stated above)… so either that is wrong or I’m missing something.
I’m a bit at loss and would appreciate some help.
Edit: Related issue here