I'm having trouble with Python Fabric removing some local files. Yet, I found a related post on StackOverflow with a solution. But I am wondering why does adding 2>&1
at the end fix it?
I can run the following perfectly fine in my terminal:
$ find app/views/ -type f -name '*%%.php' -exec rm {} \;
However when I do a fabric call I get:
$ fab rmcache
[localhost] local: find app/views/ -type f -name '*%%.php' -exec rm {} \;
find: missing argument to `-exec'
Fatal error: local() encountered an error (return code 1) while executing 'find
app/views/ -type f -name '*%%.php' -exec rm {} \;'
0: Why does it require 2>&1
through Fabric, but not locally?
1: Why does this work through Fabric?
def rmcache():
local("find {0} -type f -name '*%%.php' -exec rm {{}} \ 2>&1;".format('app/views/'));
2: But this does not work through fabric?
def rmcache():
local("find {0} -type f -name '*%%.php' -exec rm {{}} \;".format('app/views/'));