Skip to content

Commit

Permalink
handle spaces in input param defaults (redcanaryco#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
clr2of8 authored and Michael Haag committed Oct 21, 2019
1 parent d336c79 commit 3d839e7
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@ function Invoke-AtomicTest {
$isElevated = $false
}
function Get-InputArgs([hashtable]$ip) {
$inputArgsDefault = [Array]($ip.Keys).Split(" ")
$inputDefaults = [Array]($ip.Values | ForEach-Object { $_.default.toString() }).Split(" ")
$defaultArgs = @{ }
for ($i = 0; $i -lt $inputArgsDefault.Length; $i++) {
$defaultArgs[$inputArgsDefault[$i]] = $inputDefaults[$i]

foreach ($key in $ip.Keys) {
$defaultArgs[$key] = $ip[$key].default
}
# overwrite defaults with any user supplied values
foreach ($key in $InputArgs.Keys) {
Expand Down Expand Up @@ -290,4 +287,4 @@ function Invoke-AtomicTest {

} # End of PROCESS block
END { } # Intentionally left blank and can be removed
}
}

0 comments on commit 3d839e7

Please sign in to comment.