Terminal.icl 694 Bytes
Newer Older
Mart Lubbers's avatar
Mart Lubbers committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
implementation module iTasks.Extensions.Terminal

import System.Process
import System.Time
import Text
from Data.Func import $
import iTasks
import Text.Terminal.VT100

import StdArray
runProcessInteractive :: !VT100Settings !FilePath ![String] !(Maybe FilePath) -> Task Int
runProcessInteractive vt100 fp args wd =
	withShared [] \stdin->
	withShared ([], []) \stdouterr->
		    (externalProcess {tv_sec=0,tv_nsec=100000000} fp args wd (Just defaultPtyOptions) stdin stdouterr <<@ NoUserInterface)
		-|| viewSharedInformation "Output" [ViewAs $ vt100render vt100 o concat o fst] stdouterr
		-|| forever (enterInformation "Data to send to stdin" [] >>= \l->upd (\ls->ls ++ [l +++ "\n"]) stdin)