Skip to content

Add ability to update PATH env var for current DSC process #430

Open
@SteveL-MSFT

Description

@SteveL-MSFT

Summary of the new feature / enhancement

With package installation (particularly on Windows), the PATH env var may be updated from install of a new app, but won't be found until the process is restarted. However, subsequent resources in the config may depend on that just installed app. We need a way to inform DSC to refresh it's PATH env var (and possibly other env vars, but currently out of scope without clear scenario).

This can't be a setenv() function as functions are resolved as part of properties. Instead, just like _exist, we can have specially defined properties that enable this behavior such as _updatePath which would be returned by a resource requesting to have PATH updated for new child processes from current DSC process (wouldn't update the actual current process PATH).

Proposed technical implementation details (optional)

Hypothetical example of use:

$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: install foo
  type: Microsoft.Windows/WinGet
  properties:
    packageName: foo
    packageVersion: 1.0
    # `_updatePath` isn't specified here as it's not sent to the resource, but the resource returns it as part of its response
- name: this assumes foo is found in PATH
  type: Test/ConfigFoo
  properties:
    bar: hello
  dependsOn: "[resourceId('Microsoft.Windows/WinGet','install foo')]"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions