I am trying to implement a multi-spec file testing suite for a project in Haskell, using hspec-discover:

-- this goes in Spec.hs
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}

This should allow me to use multiple files of the form *spec.hs, but Microsoft Visual Studio gives me the following compiler error:

hspec-discover: runInteractiveProcess: posix_spawnp: illegal operation (Inappropriate ioctl for device)

Stack, however, compiles it just fine, so I am unsure if this is just a mismatch between the compilers or if this is an an issue with input/output control the Visual Studio compiler is catching and Stack is not. Is there a fix I need to make, or is this a fluke?

1

There are 1 best solutions below

0
On

I had the same issue on MacOS. I found that the VS code app doesn't have the same PATH set by default as in a shell, so it cannot find the executable for hspec-discover.

I solved the issue by appending its location to the set of default locations using

sudo launchctl config user path /usr/bin:/bin:/usr/sbin:/sbin:/Users/<user>/.local/bin/

Note that this applies for all GUI apps and requires a reboot to take effect. See also the entry for OS X 10.10 (and higher) in https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications