Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fredrik Wieczerkowski
curry-libs
Commits
77a7b6fc
Commit
77a7b6fc
authored
Mar 11, 2015
by
Björn Peemöller
Browse files
Adopted KiCS2 behaviour of evalCmd for PAKCS
parent
bbdf75d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
IOExts.curry.pakcs
View file @
77a7b6fc
...
...
@@ -16,10 +16,10 @@ module IOExts
, IORef, newIORef, readIORef, writeIORef, modifyIORef
) where
import Char
(isSpace
)
import Directory(removeFile)
import Char
(isAlphaNum
)
import Directory
(removeFile)
import IO
import Read(readNat)
import Read
(readNat)
import System
--- Executes a command with a new default shell process.
...
...
@@ -58,7 +58,17 @@ evalCmd cmd args input = do
removeFile tmpfile
return (readNat ecodes, outs, errs)
where
wrapArg s = if any isSpace s then '"':s++"\"" else s
wrapArg str
| null str = "''"
-- goodChar is a pessimistic predicate, such that if an argument is
-- non-empty and only contains goodChars, then there is no need to
-- do any quoting or escaping
| all goodChar str = str
| otherwise = '\'' : foldr escape "'" str
where escape c s
| c == '\'' = "'\\''" ++ s
| otherwise = c : s
goodChar c = isAlphaNum c || c `elem` "-_.,/"
--- Reads from an input handle until EOF and returns the input.
hGetEOF :: Handle -> IO String
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment