Launching Programs (example: Vim) from Haskell

169 Views Asked by At

Using the Turtle shell scripting library I am trying to launch a program, i.e:

shell "vim" empty

The problem is that this yields the warning Warning: Input is not from a terminal and causes Vim to lag for a few seconds before finally launching.

Questions:

  1. Is shell the best Turtle function to launch an external program from haskell?
  2. If so, is there any way to get around errors like the above?
2

There are 2 best solutions below

0
On BEST ANSWER

You want to use functions from the process library, specifically createProcess or runProcess.

Relevant turtle thread on the issue here.

Example usage.

2
On

You could try manually setting up I/O to the vty. E.g. in bash: vim < $TTY > $TTY. I guess turtle is doing that with its own file descriptors under the hood, based on the warning, so you should be able to manually set up those redirects (or just use the command I gave via shell). You just need to make sure you've got a TTY environment var around.