diff options
author | Brad King <brad.king@kitware.com> | 2021-10-27 13:20:30 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-10-27 13:20:46 (GMT) |
commit | b33c67a6f741838c3e5ddd7094580d8cb327dc9e (patch) | |
tree | 256fddc5851f266623354f2f2d219d033adbf60e /Source/CTest | |
parent | 7059b9dc5f73dd9448b0a63462b8a294e6978cd6 (diff) | |
parent | 69f95cf1d93945ace09ee9a87c0185b1ee6e4a47 (diff) | |
download | CMake-b33c67a6f741838c3e5ddd7094580d8cb327dc9e.zip CMake-b33c67a6f741838c3e5ddd7094580d8cb327dc9e.tar.gz CMake-b33c67a6f741838c3e5ddd7094580d8cb327dc9e.tar.bz2 |
Merge topic 'envmod-support-mod-to-new-variables'
69f95cf1d9 cmCTestRunTest: fix modifying non-existent envvars
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6663
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 20f0ed3..2d1562a 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -800,13 +800,9 @@ bool cmCTestRunTest::ForkProcess( auto apply_diff = [&env_application](const std::string& name, std::function<void(std::string&)> const& apply) { - auto entry = env_application.find(name); - std::string output; - if (entry != env_application.end() && entry->second) { - output = *entry->second; - } + std::string output = env_application[name].value_or(std::string{}); apply(output); - entry->second = output; + env_application[name] = output; }; bool err_occurred = false; |