Skip to content

Setting up an exporter using a Job will fail #9

Description

@DennisL68

When using a job in PowerShell Windows 5,1 for running the Exporter, the job will fail with

Exception setting "TreatControlCAsInput":  "The handle is invalid.
"
At C:\Program Files\WindowsPowerShell\Modules\PromethuesExporter\0.1.0\PrometheusExporter.psm1:117 char:9
+        [Console]::TreatControlCAsInput = $True
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo           :  NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId  :  ExceptionsWhenSetting

as a job has no input handler.

A switch, -Interactive, might be an appropriate change to use when Ctrl-C is a viable input.

Or better yet, don't look for Ctrl-C at all, the script will still abort when breaking...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions