Gabriella439 / turtle

Shell programming, Haskell style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`set -e` equivalent in turtle

joelmccracken opened this issue · comments

I've recently been converting some shell scripts to turtle, and I noticed that a simple translation wasn't quite right, because I use set -e in my shell scripts, but turtle doesn't have this. I was thinking something like what you have in the tutorial might be nice to just have in the library. Obviously I could just add this to my own scripts, but I think it might be helpful to steer people towards this behavior:

shellE = do
    x <- shell cmd empty
    case x of
        ExitSuccess   -> return ()
        ExitFailure n -> die (cmd <> " failed with exit code: " <> rep

@joelmccracken: I believe the turtle analog of set -e would be the shells and procs utilities

Ahh yes, I think you're right. I should have figured! I'll close it then, thanks.

You're welcome! 🙂