-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Having an issue with figuring out how to use handles. Also wanted to verify handles are the correct solution rather than say runFoldLines or the other alternative I can't recall at the moment.
Surely examples of how to do the two snippets below in Shelly would be useful to many people:
zcat large.mysql.gz | mysql largedb
cat bigfile | grep things
I guess those two are pretty much the same, though I think runFoldLines might be a better alternative for the second.
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
import Data.Monoid
import Data.Text as T
import Shelly
default (T.Text)
main = shelly $ do
-- I'm trying to do "zcat large.mysql.gz | mysql largedb" basically
-- minimal reproduction:
run "echo" ["a very large file"] -|- run_ "grep" ["file"] -- predictably runs out of memory
-- runHandle "echo" ["test"] $ \h -> run "grep" ["test"] -- thought this was the equivalent
Metadata
Metadata
Assignees
Labels
No labels