Fixed two syntax issues with cmd.exec_code

This commit is contained in:
Seth House 2011-09-23 23:30:40 -06:00
parent 9e63413e04
commit 08bca6a316

View file

@ -127,7 +127,7 @@ def has_exec(cmd):
return True
return False
def exec_code(lang, code):
def exec_code(lang, code, cwd=DEFAULT_CWD):
'''
Pass in two strings, the first naming the executable language, aka -
python2, python3, ruby, perl, lua, etc. the second string containing
@ -136,7 +136,7 @@ def exec_code(lang, code):
CLI Example:
salt '*' cmd.exec_code ruby 'puts "cheese"'
'''
cfn = tempfile.mkstemp()
fd, cfn = tempfile.mkstemp()
open(cfn, 'w+').write(code)
return subprocess.Popen(lang + ' ' + cfn,
shell=True,