Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Don't barf if PAGER="less -R" #1

Closed
wants to merge 4 commits into from

2 participants

@mikeplus64

Before it would try to do rawSystem "less -R" [], which would try to run a file called "less -R", and not have "-R" in its arguments.

@shachaf
Owner

After a discussion on IRC we decided to implement this as 630196a instead.

@shachaf shachaf closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +1 −1  ghc-core.cabal
  2. +5 −4 ghc-core.hs
View
2  ghc-core.cabal
@@ -1,5 +1,5 @@
name: ghc-core
-version: 0.5.6
+version: 0.5.7
license: BSD3
license-file: LICENSE
author: Don Stewart
View
9 ghc-core.hs
@@ -128,10 +128,11 @@ main = do
showInPager :: FilePath -> IO ExitCode
showInPager file = do
- mv <- getEnvMaybe "PAGER"
- let pager = fromMaybe "less" mv
- pagerOpts = if pager == "less" then ["-R"] else []
- rawSystem pager (pagerOpts ++ [file])
+ (pager:opts) <- maybe ["less", "-R"] (maybeAddOpts . words) <$> getEnvMaybe "PAGER"
+ rawSystem pager (opts ++ [file])
+ where
+ maybeAddOpts ("less":opts) = "less" : if "-R" `elem` opts then opts else "-R":opts
+ maybeAddOpts pager = pager
--
-- Clean up the output with some regular expressions.
Something went wrong with that request. Please try again.