mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixed two syntax issues with cmd.exec_code
This commit is contained in:
parent
9e63413e04
commit
08bca6a316
1 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue