Bug Description
In Install-ServyService, the Pre-stop and Post-stop parameters are declared without a [string] type, while all equivalent parameter groups (PreLaunch, PostLaunch, main parameters) are properly typed as [string].
Actual Behavior
The Pre-stop and Post-stop parameters (lines 556–565):
# Pre-stop
$PreStopPath,
$PreStopStartupDir,
$PreStopParams,
$PreStopTimeout,
[switch] $PreStopLogAsError,
# Post-stop
$PostStopPath,
$PostStopStartupDir,
$PostStopParams
Compare with the equivalent Pre-launch parameters which are correctly typed:
[string] $PreLaunchPath,
[string] $PreLaunchStartupDir,
[string] $PreLaunchParams,
[string] $PreLaunchTimeout,
Without the [string] type, PowerShell accepts any object type (arrays, integers, booleans, etc.). When these values are passed to Add-Arg, unexpected type coercion may occur.
Suggested Fix
Add [string] type declarations to all Pre-stop and Post-stop parameters:
# Pre-stop
[string] $PreStopPath,
[string] $PreStopStartupDir,
[string] $PreStopParams,
[string] $PreStopTimeout,
[switch] $PreStopLogAsError,
# Post-stop
[string] $PostStopPath,
[string] $PostStopStartupDir,
[string] $PostStopParams
Environment
- PowerShell module:
Servy.psm1
- Affects:
Install-ServyService function (lines 556–565)
Bug Description
In
Install-ServyService, the Pre-stop and Post-stop parameters are declared without a[string]type, while all equivalent parameter groups (PreLaunch, PostLaunch, main parameters) are properly typed as[string].Actual Behavior
The Pre-stop and Post-stop parameters (lines 556–565):
Compare with the equivalent Pre-launch parameters which are correctly typed:
Without the
[string]type, PowerShell accepts any object type (arrays, integers, booleans, etc.). When these values are passed toAdd-Arg, unexpected type coercion may occur.Suggested Fix
Add
[string]type declarations to all Pre-stop and Post-stop parameters:Environment
Servy.psm1Install-ServyServicefunction (lines 556–565)