Skip to content

PowerShell Task when does not expose _installdir by default #3395

@sprankle

Description

@sprankle

def windows_context
{
stdout_command: ['echo hello', /hello/],
stderr_command: ['$host.ui.WriteErrorLine("oops")', /oops/],
pipe_command: ["Get-Service | Where-Object {$_.Name -like \"*net*\"}", /Netman/],
destination_dir: 'C:/mytmp',
supported_req: 'powershell',
extension: '.ps1',
unsupported_req: 'shell',
cat_cmd: 'cat',
rm_cmd: 'rm -Recurse -Force',
ls_cmd: 'ls -Name',
env_command: 'Write-Output ${env:BOLT_TEST_VAR}',
env_task: "Write-Output \"${env:PT_message_one}\n${env:PT_message_two}\"",
stdin_task: "$line = [Console]::In.ReadLine()\nWrite-Output \"$line\"",
find_task: 'Get-ChildItem -Path $env:PT__installdir -Recurse -File | % { Write-Host $_.Length $_.FullName }',
identity_script: "echo $PSScriptRoot",
echo_script: "$args | ForEach-Object { Write-Output $_ }"
}
end

$env:PT__installdir Is not available in the scope of a PowerShell task. Part of the declaration of the task requires the PowerShell to expect _installdir as a passed argument for the value to extend scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions