Skip to content

Commit

Permalink
Merge pull request #50415 from flassman/pass-cwd-to-runas_system
Browse files Browse the repository at this point in the history
cwd needs to be passed from runas() to runas_system()
  • Loading branch information
Nicole Thomas committed Nov 8, 2018
2 parents ef4509e + 0113137 commit 93095cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions salt/utils/win_runas.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def make_inheritable(token):
win32con.DUPLICATE_SAME_ACCESS)


def runas_system(cmd, username, password):
def runas_system(cmd, username, password, cwd=None):
# This only works as system, when salt is running as a service for example

# Check for a domain
Expand Down Expand Up @@ -352,7 +352,7 @@ def runas_system(cmd, username, password):
1,
0,
user_environment,
None,
cwd,
startup_info)

hProcess, hThread, PId, TId = \
Expand Down Expand Up @@ -397,7 +397,7 @@ def runas(cmd, username, password, cwd=None):
# This only works when not running under the system account
# Debug mode for example
if salt.utils.win_functions.get_current_user() == 'SYSTEM':
return runas_system(cmd, username, password)
return runas_system(cmd, username, password, cwd)

# Create a pipe to set as stdout in the child. The write handle needs to be
# inheritable.
Expand Down

0 comments on commit 93095cb

Please sign in to comment.