mirror of
https://github.com/textmate/textmate.git
synced 2026-01-14 17:28:05 -05:00
Process working directory not always setup
This is a fairly subtle bug: We were implicitly creating a temporary std::string object and requesting c_str from this object. This C string’s lifetime was that of the temporary std::string, and as we did a lot of std::string creation in the following line, with the new libc++, there was a good chance that the temporary string buffer would be re-used and so, our working directory would be set to a bogus value. This closes issue #329.
This commit is contained in:
@@ -159,7 +159,8 @@ namespace oak
|
||||
output_fd = outputPipe[0];
|
||||
error_fd = errorPipe[0];
|
||||
|
||||
char const* workingDir = (environment.find("PWD") != environment.end() ? environment["PWD"] : path::temp()).c_str();
|
||||
std::string const wdString = environment.find("PWD") != environment.end() ? environment["PWD"] : path::temp();
|
||||
char const* workingDir = wdString.c_str();
|
||||
oak::c_array env(environment);
|
||||
|
||||
process_id = vfork();
|
||||
|
||||
Reference in New Issue
Block a user