on master help sign in
Let the sub-process handle Ctrl+C. Fixes #89
commit171aaaae2dc2483319e168ffdfb82ad0712ce61f authorDivam <dfordivam@gmail.com> dateFri 7 Dec 2018, 10:02 (8 years ago) parent61dce9b
1 file changed+5−2
lib/command/src/Obelisk/Command/Project.hs+5−2
lib/command/src/Obelisk/Command/Project.hs+5−2
@@ -26,7 +26,7 @@ import System.FilePath
2626import System.IO.Temp
2727import System.Posix (FileStatus, UserID, deviceID, fileID, fileMode, fileOwner, getFileStatus, getRealUserID)
2828import System.Posix.Files
29−import System.Process (CreateProcess, cwd, proc, waitForProcess)
29+import System.Process (CreateProcess, cwd, proc, waitForProcess, delegate_ctlc)
3030
3131import GitHub.Data.GitData (Branch)
3232import GitHub.Data.Name (Name)
@@ -204,7 +204,7 @@ inImpureProjectShell shellName command = withProjectRoot "." $ \root ->
204204
205205projectShell :: MonadObelisk m => FilePath -> Bool -> String -> String -> m ()
206206projectShell root isPure shellName command = do
207− (_, _, _, ph) <- createProcess_ "runNixShellAttr" $ setCwd (Just root) $ proc "nix-shell" $
207+ (_, _, _, ph) <- createProcess_ "runNixShellAttr" $ setCtlc $ setCwd (Just root) $ proc "nix-shell" $
208208 [ "--pure" | isPure ] <>
209209 [ "-A"
210210 , "shells." <> shellName
@@ -212,5 +212,8 @@ projectShell root isPure shellName command = do
212212 ]
213213 void $ liftIO $ waitForProcess ph
214214
215+setCtlc :: CreateProcess -> CreateProcess
216+setCtlc cfg = cfg { delegate_ctlc = True }
217+
215218setCwd :: Maybe FilePath -> CreateProcess -> CreateProcess
216219setCwd fp cfg = cfg { cwd = fp }