pallet/pallet — Issue #109: scripts crash if variables are used within a pipe
Author: thearthur
Created: 2012-01-31 05:06:04+00:00
State: open

this script crashes:
hello-pallet.core> (defn foo [n] (pallet.stevedore/script (set! x 4) (ls ~n)))
#'hello-pallet.core/foo
hello-pallet.core> (pallet.execute/local-script (pipe ~(foo "~/") (grep "a")))
{:exit 2, :out "android-sdk-linux_x86\nbin\ncap.cap\nchef\nclojurescript\nDesktop\nDocuments\nDownloads\nDropbox\ndwolla\nerror\nesc\nexamples.desktop\nfoo\nhello\nhello-pallet\nhta\nHTA\nhtcc\ninstall-scripts\njenkins\njenkins-backup\nlearn_puppet_centos.vmwarevm\nMusic\nnailgun\nnote\nopt\npallettest\nPictures\npoclbm.py\nPublic\npython-jsonrpc\nqa\nqa.arc-stuff-old\n#.recentf#\nsso-config\nTemplates\ntmp\n#tmp.clj#\nubuntu-vmserver\nVideos\nvmware\nWualaDrive\n", :err "/tmp/pallet4070959901324922965script: line 287: syntax error near unexpected token `|'\n/tmp/pallet4070959901324922965script: line 287: ` | grep a'\n"}

but if I remove the (set! x 4) then it works

hello-pallet.core> (defn foo [n] (pallet.stevedore/script (ls ~n)))
#'hello-pallet.core/foo
hello-pallet.core> (pallet.execute/local-script (pipe ~(foo "~/") (grep "a")))
{:exit 0, :out "android-sdk-linux_x86\ncap.cap\nDownloads\ndwolla\nexamples.desktop\nhello-pallet\nhta\ninstall-scripts\njenkins-backup\nlearn_puppet_centos.vmwarevm\nnailgun\npallettest\nqa\nqa.arc-stuff-old\nTemplates\nvmware\nWualaDrive\n", :err ""}

pallet 0.6.6