Fix string view created from a temporary string
This is clearly a case where rust style lifetime analysis would have been nice, hopefully it comes with GSL lifetime extensions... Fixes #680
This commit is contained in:
parent
fa35330b42
commit
5cab2078f8
|
@ -1871,8 +1871,7 @@ const CommandDesc change_working_directory_cmd = {
|
||||||
}},
|
}},
|
||||||
[](const ParametersParser& parser, Context&, const ShellContext&)
|
[](const ParametersParser& parser, Context&, const ShellContext&)
|
||||||
{
|
{
|
||||||
|
StringView target = parser.positional_count() == 1 ? StringView{parser[0]} : "~";
|
||||||
StringView target = parser.positional_count() == 1 ? parser[0] : "~";
|
|
||||||
if (chdir(parse_filename(target).c_str()) != 0)
|
if (chdir(parse_filename(target).c_str()) != 0)
|
||||||
throw runtime_error(format("cannot change to directory '{}'", target));
|
throw runtime_error(format("cannot change to directory '{}'", target));
|
||||||
for (auto& buffer : BufferManager::instance())
|
for (auto& buffer : BufferManager::instance())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user