Skip to content

"Unexpected response from haskell process" when loading in new session #882

Closed
@cmears

Description

@cmears

Sometimes when you press C-c C-l to start a new session and immediately load a file, I get "Unexpected response from haskell process." I think this is due to a race condition.

When the new session starts, it issues a few commands to set the prompt, set verbosity and change directory. If the empty response to these commands comes late, they appear to haskell-mode to be in response to the load command, which doesn't match the expected output.

That is, you get this timeline:

send "cd"
send "load"
receive empty response (from the cd)
receive response "compiling, loading modules, etc." (from the load)

It doesn't always happen, (un)fortunately. You can see it in action in the log below -- the last few lines are the interesting bit. I've tried fiddling around with a few things but I don't know the right way to fix it.

("Starting inferior stack GHCi process using stack" "haskell" nil "stack" "ghci" "--ghc-options=-ferror-spans")

-> :set prompt "\4"

-> Prelude.putStrLn ""

-> :set -v1

<- Run from outside a project, using implicit global config

   Using resolver: lts-2.15 from global config file: /home/chris/.stack/global/stack.yaml



<- Configuring GHCi with the following packages: 



<- GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help



<- Loading package ghc-prim ... 

<- linking ... done.

   Loading package integer-gmp ... linking ... done.

   Loading package base ... linking ... done.



<- Prelude

<- > �

-> :cd /home/chris/elisp/others/haskell-mode/

<- 



<- ��

-> :load "/home/chris/elisp/others/haskell-mode/Test.hs"

<- �

<- [1 of 1] Compiling Test             ( /home/chris/elisp/others/haskell-mode/Test.hs, /home/chris/.stack/global/.stack-work/odir/Test.ghcio )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions