@@ -5,9 +5,9 @@
5{-# LANGUAGE MultiWayIf #-}
5{-# LANGUAGE MultiWayIf #-}
6{-# LANGUAGE OverloadedStrings #-}
6{-# LANGUAGE OverloadedStrings #-}
7{-# LANGUAGE PatternGuards #-}
7{-# LANGUAGE PatternGuards #-}
8+{-# LANGUAGE QuasiQuotes #-}
8{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE TypeApplications #-}
10{-# LANGUAGE TypeApplications #-}
10−{-# LANGUAGE QuasiQuotes #-}
11module Obelisk.Command.Thunk where
11module Obelisk.Command.Thunk where
13import Control.Applicative
13import Control.Applicative
@@ -368,7 +368,7 @@ overwriteThunk target thunk = do
368 Right _ -> pure ()
368 Right _ -> pure ()
370 --TODO: Is there a safer way to do this overwriting?
370 --TODO: Is there a safer way to do this overwriting?
371− liftIO $ removeDirectoryRecursive target
371+ callProcessAndLogOutput (Debug, Error) $ proc rmPath ["-r", target] -- target may be a symlink
372 createThunk target thunk
372 createThunk target thunk
374thunkPtrToSpec :: ThunkPtr -> ThunkSpec
374thunkPtrToSpec :: ThunkPtr -> ThunkSpec
@@ -751,7 +751,7 @@ unpackThunk' noTrail thunkDir = checkThunkDirectory "Can't pack/unpack from with
751 callProcessAndLogOutput (Notice, Error) $
751 callProcessAndLogOutput (Notice, Error) $
752 proc cp ["-r", "-T", thunkDir </> ".", obGitDir </> "orig-thunk"]
752 proc cp ["-r", "-T", thunkDir </> ".", obGitDir </> "orig-thunk"]
753 callProcessAndLogOutput (Notice, Error) $
753 callProcessAndLogOutput (Notice, Error) $
754− proc "rm" ["-r", thunkDir]
754+ proc rmPath ["-r", thunkDir]
755 callProcessAndLogOutput (Notice, Error) $
755 callProcessAndLogOutput (Notice, Error) $
756 proc "mv" ["-T", tmpRepo, thunkDir]
756 proc "mv" ["-T", tmpRepo, thunkDir]
@@ -767,7 +767,7 @@ packThunk' noTrail (ThunkPackConfig force thunkConfig) thunkDir = checkThunkDire
767 withSpinner' ("Packing thunk " <> T.pack thunkDir)
767 withSpinner' ("Packing thunk " <> T.pack thunkDir)
768 (finalMsg noTrail $ const $ "Packed thunk " <> T.pack thunkDir) $ do
768 (finalMsg noTrail $ const $ "Packed thunk " <> T.pack thunkDir) $ do
769 thunkPtr <- modifyThunkPtrByConfig thunkConfig <$> getThunkPtr (not force) thunkDir (_thunkConfig_private thunkConfig)
769 thunkPtr <- modifyThunkPtrByConfig thunkConfig <$> getThunkPtr (not force) thunkDir (_thunkConfig_private thunkConfig)
770− liftIO $ removeDirectoryRecursive thunkDir
770+ callProcessAndLogOutput (Debug, Error) $ proc rmPath ["-r", thunkDir] -- thunkDir may be a symlink
771 createThunk thunkDir thunkPtr
771 createThunk thunkDir thunkPtr
772 pure thunkPtr
772 pure thunkPtr