Skip to content

Expanding a non-existing environment variable expands to the name of the non-existent environment variable #57

@davidm-ro

Description

@davidm-ro

First, expanding an existing environment variable works, eg:

var homeVar = expand("$HOME");
log("HOME = '" + homeVar + "'");

This prints my home directory.

However, when the env var does not exist, I get what to me is unexpected behaviour:

var testVar = expand("$NONEXISTENT_VAR");
log("NONEXISTENT_VAR = '" + testVar + "'");

Expected

testVar is empty, or undefined.

Observed

testVar is a string with value $NONEXISTENT_VAR. Ie, it seems to expand the non-existent variable to itself, or, not fail for a non-existent variable so it's left unaltered.

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