on master help sign in
command: Properly refresh/reload ghcid on config and cabal changes
commit5eb79faaecd5cf9ea7b27e055b235b981dc8c304 authorElliot Cameron <eacameron@gmail.com> dateThu 30 Jan 2020, 23:11 (7 years ago) parent35eb70b
1 file changed+7−2
lib/command/src/Obelisk/Command/Run.hs+7−2
lib/command/src/Obelisk/Command/Run.hs+7−2
@@ -315,11 +315,16 @@ runGhcid root chdirToRoot dotGhci packages mcmd =
315315 opts =
316316 [ "-W"
317317 , "--command='ghci -ignore-dot-ghci " <> makeBaseGhciOptions dotGhci <> "' "
318− , "--reload=config"
319318 , "--outputfile=ghcid-output.txt"
320− ] <> testCmd
319+ ] <> map (\x -> "--reload='" <> x <> "'") reloadFiles
320+ <> map (\x -> "--restart='" <> x <> "'") restartFiles
321+ <> testCmd
321322 testCmd = maybeToList (flip fmap mcmd $ \cmd -> "--test='" <> cmd <> "'") -- TODO: Shell escape
322323
324+ adjustRoot x = if chdirToRoot then makeRelative root x else x
325+ reloadFiles = map adjustRoot [root </> "config"]
326+ restartFiles = map (adjustRoot . _cabalPackageInfo_packageFile) packages
327+
323328makeBaseGhciOptions :: FilePath -> String
324329makeBaseGhciOptions dotGhci =
325330 unwords