allow complex shell commands

This commit is contained in:
Joey Hess 2024-09-23 15:04:33 -04:00
parent 5a4bee24b8
commit 6b040ed32d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -287,11 +287,11 @@ applySimCommand c@(CommandVisit repo cmdparams) st _ =
unlessM (liftIO $ doesDirectoryExist dir) $ unlessM (liftIO $ doesDirectoryExist dir) $
giveup "Simulated repository unavailable." giveup "Simulated repository unavailable."
(cmd, params) <- case cmdparams of (cmd, params) <- case cmdparams of
(cmd:params) -> return (cmd, params)
[] -> do [] -> do
showLongNote "Starting a shell in the simulated repository." showLongNote "Starting a shell in the simulated repository."
shellcmd <- liftIO $ fromMaybe "sh" <$> getEnv "SHELL" shellcmd <- liftIO $ fromMaybe "sh" <$> getEnv "SHELL"
return (shellcmd, []) return (shellcmd, [])
_ -> return ("sh", ["-c", unwords cmdparams])
exitcode <- liftIO $ exitcode <- liftIO $
safeSystem' cmd (map Param params) safeSystem' cmd (map Param params)
(\p -> p { cwd = Just dir }) (\p -> p { cwd = Just dir })