Skip to content

Install-ServyService: Pre-stop and Post-stop parameters missing [string] type declaration #52

@Christophe-Rogiers

Description

@Christophe-Rogiers

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)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions