mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed win_nssm escaping issue (#22512)
* bugfix: applicaiton setting was not properly escaped leading to issues when picking application under C:\Program Files (x86)\...
This commit is contained in:
parent
52e6c54d49
commit
1d14de1d8c
1 changed files with 4 additions and 4 deletions
|
@ -135,7 +135,7 @@ Function Nssm-Install
|
|||
|
||||
if (!(Service-Exists -name $name))
|
||||
{
|
||||
$results = Nssm-Invoke "install ""$name"" $application"
|
||||
$results = Nssm-Invoke "install ""$name"" ""$application"""
|
||||
|
||||
if ($LastExitCode -ne 0)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ Function Nssm-Install
|
|||
|
||||
if ($results -cnotlike $application)
|
||||
{
|
||||
$cmd = "set ""$name"" Application $application"
|
||||
$cmd = "set ""$name"" Application ""$application"""
|
||||
|
||||
$results = Nssm-Invoke $cmd
|
||||
|
||||
|
@ -179,7 +179,7 @@ Function Nssm-Install
|
|||
if ($result.changed)
|
||||
{
|
||||
$applicationPath = (Get-Item $application).DirectoryName
|
||||
$cmd = "nssm set ""$name"" AppDirectory $applicationPath"
|
||||
$cmd = "nssm set ""$name"" AppDirectory ""$applicationPath"""
|
||||
|
||||
$results = invoke-expression $cmd
|
||||
|
||||
|
@ -695,4 +695,4 @@ Try
|
|||
Catch
|
||||
{
|
||||
Fail-Json $result $_.Exception.Message
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue