diff options
| author | aarne <unknown> | 2005-10-06 13:21:33 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2005-10-06 13:21:33 +0000 |
| commit | bf2fdeb22ef950f7f5f375a3f4cf5f90abf87fd8 (patch) | |
| tree | 89b99ebe943973d9fc03eb8c14dc69533615d958 /src/GF/Shell.hs | |
| parent | c2aeb9ae16c344c354194ec2efac773bbb7ce5d1 (diff) | |
eqStr ; pipe to system
Diffstat (limited to 'src/GF/Shell.hs')
| -rw-r--r-- | src/GF/Shell.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index 6e4cf45fd..6aca6ff09 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/10/06 10:02:33 $ +-- > CVS $Date: 2005/10/06 14:21:34 $ -- > CVS $Author: aarne $ --- > CVS $Revision: 1.44 $ +-- > CVS $Revision: 1.45 $ -- -- GF shell command interpreter. ----------------------------------------------------------------------------- @@ -313,7 +313,9 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com CWriteFile file -> justOutputArg opts (writeFile file) sa CAppendFile file -> justOutputArg opts (appendFile file) sa CSpeakAloud -> justOutputArg opts (speechGenerate opts) sa - CSystemCommand s -> justOutput opts (system s >> return ()) sa + CSystemCommand s -> case a of + AUnit -> justOutput opts (system s >> return ()) sa + _ -> systemArg opts a s sa CPutString -> changeArg (opSS2CommandArg (optStringCommand opts gro)) sa ----- CShowTerm -> changeArg (opTS2CommandArg (optPrintTerm opts gro) . s2t) sa CGrep ms -> changeArg (AString . unlines . filter (grep ms) . lines . prCommandArg) sa @@ -417,6 +419,16 @@ justOutputArg opts f sa@(st,a) = f (utf (prCommandArg a)) >> return (st, AUnit) justOutput :: Options -> IO () -> ShellIO justOutput opts = justOutputArg opts . const +systemArg :: Options -> CommandArg -> String -> ShellIO +systemArg _ cont syst sa = do + writeFile tmpi $ prCommandArg cont + system $ syst ++ " <" ++ tmpi ++ " >" ++ tmpo + s <- readFile tmpo + returnArg (AString s) sa + where + tmpi = "_tmpi" --- + tmpo = "_tmpo" + -- | type system for command arguments; instead of plain strings... data CommandArg = AError String |
