Make $pipestatus thread safe and other misc cleanup

This commit is contained in:
ridiculousfish
2019-02-10 13:43:02 -08:00
parent 2c8abdf5cb
commit 2c3214cabd
7 changed files with 24 additions and 33 deletions

View File

@@ -1392,13 +1392,13 @@ maybe_t<env_var_t> env_stack_t::get(const wcstring &key, env_mode_flags_t mode)
if (history) history->get_history(result);
return env_var_t(L"history", result);
} else if (key == L"pipestatus") {
const auto& js = proc_get_last_job_statuses();
const auto js = proc_get_last_job_statuses();
wcstring_list_t result;
result.reserve(js->size());
for (auto&& i : *js) {
result.emplace_back(to_string(i));
result.reserve(js.size());
for (int i : js) {
result.push_back(to_string(i));
}
return env_var_t(L"pipestatus", result);
return env_var_t(L"pipestatus", std::move(result));
} else if (key == L"status") {
return env_var_t(L"status", to_string(proc_get_last_status()));
} else if (key == L"umask") {