mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
powershell: Respect remote_tmp path set by the user (#40210)
* powershell: Respect remote_tmp path set by the user * Fixed up linting error and typo * Added changelog
This commit is contained in:
parent
070a5557d1
commit
f84f3de7c2
18 changed files with 281 additions and 203 deletions
|
@ -335,7 +335,25 @@ Function Load-CommandUtils {
|
|||
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
|
||||
#
|
||||
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
|
||||
|
||||
# FUTURE: find a better way to get the _ansible_remote_tmp variable
|
||||
$original_tmp = $env:TMP
|
||||
$original_temp = $env:TEMP
|
||||
|
||||
$remote_tmp = $original_tmp
|
||||
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
|
||||
if ($module_params) {
|
||||
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
|
||||
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
|
||||
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
|
||||
}
|
||||
}
|
||||
|
||||
$env:TMP = $remote_tmp
|
||||
$env:TEMP = $remote_tmp
|
||||
Add-Type -TypeDefinition $process_util
|
||||
$env:TMP = $original_tmp
|
||||
$env:TEMP = $original_temp
|
||||
}
|
||||
|
||||
Function Get-ExecutablePath($executable, $directory) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue