Commit 2b17cb01 authored by Mart Lubbers's avatar Mart Lubbers

update basicapiexamples

parent ce6129af
......@@ -12,6 +12,7 @@ import iTasks.Extensions.Currency
import iTasks.Extensions.Contact
import iTasks.Extensions.DateTime
import iTasks.Extensions.Clock
import iTasks.Extensions.Terminal, Text.Terminal.VT100
import Text, Text.HTML, StdArray, StdMisc
import iTasks.Internal.Tonic
//import ligrettoTOP
......@@ -709,12 +710,8 @@ add_cell new turn board
externalProcessExample =
enterInformation "Enter the path to the external process. To for instance open a shell run '/bin/bash' or 'c:\\Windows\\System32\\cmd.exe'." [] >>= \path ->
withShared [] \stdin->
withShared ([], []) \stdouterr->
(externalProcess {tv_sec=0,tv_nsec=100000000} path [] Nothing (Just defaultPtyOptions) stdin stdouterr <<@ NoUserInterface)
-|| viewSharedInformation "Output" [] stdouterr
-|| forever (enterInformation "Data to send to stdin" [] >>= \l->upd (\ls->ls ++ [l +++ "\n"]) stdin)
enterInformation "Enter the path to the external process. To for instance open a shell run '/bin/bash' or 'c:\\Windows\\System32\\cmd.exe'." []
>>= \path->runProcessInteractive zero path [] Nothing
//* Customizing interaction with views
......
definition module iTasks.Extensions.Terminal
from Data.Maybe import :: Maybe
from iTasks.WF.Definition import :: Task
from System.FilePath import :: FilePath
from Text.Terminal.VT100 import :: VT100Settings
runProcessInteractive :: !VT100Settings !FilePath ![String] !(Maybe FilePath) -> Task Int
implementation module iTasks.Extensions.Terminal
import System.Process
import System.Time
import Text
from Data.Func import $
import iTasks
import Text.Terminal.VT100
import StdDebug
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment