Skip to content

Calling string() on environment variables with empty values fails on Windows #554

@aliquis162

Description

@aliquis162

When I have environment variables with no values (somehow I have two on my system - COMPLUS_InstallRoot and COMPLUS_Version), when I iterate over values of boost::process::environment::current() and try to call string() on the empty value, it fails.


boost::unordered_map<std::string, std::string> currentProcessEnvironment;

for (const auto& env : boost::process::environment::current())
{
    currentProcessEnvironment[env.key().string()] = env.value().string();    // fails if env.value().empty()
}

Fix for this should be simple, all needed should be just to apply this for size_as_utf8 and convert_to_utf8: f372a9a

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