diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-22 20:07:18 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-22 20:08:41 +0200 |
| commit | 1204839cc27af071582b8f6c88530b6840f56f72 (patch) | |
| tree | 74bf065e10e79a0cf3691faa5e31cc5e03d73473 /src/Script/Shell.hs | |
| parent | b7832766c7225e6f455462eb92ee392249d4c737 (diff) | |
Shell: implement pwd command
Changelog: Implemented `pwd` command in shell interpreter.
Diffstat (limited to 'src/Script/Shell.hs')
| -rw-r--r-- | src/Script/Shell.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Script/Shell.hs b/src/Script/Shell.hs index 91bdcb0..fbb92af 100644 --- a/src/Script/Shell.hs +++ b/src/Script/Shell.hs @@ -154,6 +154,13 @@ executeCommand sei@ShellExecInfo {..} st pstdin pstdout pstderr scmd@ShellComman executeCommandProcess :: ShellExecInfo -> ShellState -> Handle -> Handle -> Handle -> [ Text ] -> Text -> TestRun ( TestRun ProcessStatus, ShellState ) executeCommandProcess ShellExecInfo {..} st@ShellState {..} pstdin pstdout pstderr args = \case + "pwd" + | [] <- args -> do + liftIO $ hPutStrLn pstdout shellWorkingDirectory + return ( return (Exited ExitSuccess), st ) + | otherwise -> do + liftIO $ hPutStrLn pstderr $ "pwd: too many arguments" + return ( return (Exited (ExitFailure (-1))), st ) cmd -> liftIO $ do (_, _, _, phandle) <- createProcess_ "shell" (proc (T.unpack cmd) (map T.unpack args)) |