How about `GHC.Environment.getFullArgs` which includes “—interactive” when 
you’re in GHCi?


> On 24 Nov 2015, at 09:37, Levent Erkok <erk...@gmail.com> wrote:
> 
> I'm working on a plugin, and would like to be able to tell if it's GHC or 
> GHCi that's running.
> 
> I tried:
> 
>    df   <- getDynFlags
>    let isGHCi = ghcMode df == CompManager
> 
> Alas, while that correctly tells apart "ghci" from "ghc -c", it also returns 
> True when ghc is called without the "-c" argument.
> 
> Is there a better/more robust way of figuring out whether we're in an 
> interactive session?
> 
> -Levent.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to