Skip to content

Commit 3d9f964

Browse files
committed
Set working directory for Fourmolu process
Ensures expected config files are found.
1 parent 1bd90af commit 3d9f964

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import Ormolu
3232
import System.Exit
3333
import System.FilePath
3434
import System.IO (stderr)
35-
import System.Process.Text (readProcessWithExitCode)
35+
import System.Process.Run (proc, cwd)
36+
import System.Process.Text (readCreateProcessWithExitCode)
3637

3738
descriptor :: PluginId -> PluginDescriptor IdeState
3839
descriptor plId =
@@ -60,15 +61,15 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
6061
. try @IOException
6162
$ do
6263
(exitCode, out, err) <-
63-
readProcessWithExitCode
64-
"fourmolu"
65-
( ["-d"]
66-
<> catMaybes
67-
[ ("--start-line=" <>) . show <$> regionStartLine region
68-
, ("--end-line=" <>) . show <$> regionEndLine region
69-
]
70-
<> map ("-o" <>) fileOpts
71-
)
64+
readCreateProcessWithExitCode
65+
( proc "fourmolu" $
66+
["-d"]
67+
<> catMaybes
68+
[ ("--start-line=" <>) . show <$> regionStartLine region
69+
, ("--end-line=" <>) . show <$> regionEndLine region
70+
]
71+
<> map ("-o" <>) fileOpts
72+
){cwd = Just fp'}
7273
contents
7374
T.hPutStrLn stderr err
7475
case exitCode of

0 commit comments

Comments
 (0)