Permalink
Browse files

on second thought i trust rawSystem more

  • Loading branch information...
1 parent ad31a85 commit 28308c2f4a11c06b6b34dd040c738fb333a3650b @mikeplus64 committed Dec 15, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 ghc-core.hs
View
@@ -128,11 +128,11 @@ main = do
showInPager :: FilePath -> IO ExitCode
showInPager file = do
- pager <- maybe "less -R" (maybeAddOpts . words) <$> getEnvMaybe "PAGER"
- system (pager ++ " " ++ file)
+ (pager:opts) <- maybe ["less", "-R"] (maybeAddOpts . words) <$> getEnvMaybe "PAGER"
+ rawSystem pager (opts ++ [file])
where
- maybeAddOpts ("less":opts) | "-R" `elem` opts = unwords ("less":opts)
- maybeAddOpts pager = unwords pager
+ maybeAddOpts ("less":opts) = "less" : if "-R" `elem` opts then opts else "-R":opts
+ maybeAddOpts pager = pager
--
-- Clean up the output with some regular expressions.

0 comments on commit 28308c2

Please sign in to comment.