Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Windows Client Not Reporting Correct Powershell Exit Code #1919

@dkorel-copperleaf

Description

@dkorel-copperleaf

When doing Exit 2 in powershell, sensu-client only seems to capture a status of 1.

Expected Behavior

I believe the status should be 2 when the exit code is 2.

Current Behavior

Status code 1 or 0 works as expected. If the process exits with something else, it translates to 1.

Possible Solution

I would guess windows Ruby implementation does not look to $LASTEXITCODE, but instead loots to $? which only contains a True|False value.

Steps to Reproduce (for bugs)

Run a powershell script with sensu client containing

Write-Host "TEST"
Exit 2

Sensu history and status should see a status of 2. It sees a status of 1.

Your Environment

Windows Server 2012R2
Multiple versions of sensu-client for windows. Including the latest (sensu-1.5.0-1-x86.msi)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions