diff options
| author | Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> | 2020-03-04 01:37:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-03 09:37:49 -0800 |
| commit | 8241578dbf5891f30eba4421c572154023f97214 (patch) | |
| tree | 798030288185d74d3ebafded1399e0eeeb11e7da /toolsrc/src | |
| parent | 3e57190a971e35d3fac451b240b549e9a0cdb124 (diff) | |
| download | vcpkg-8241578dbf5891f30eba4421c572154023f97214.tar.gz vcpkg-8241578dbf5891f30eba4421c572154023f97214.zip | |
Fix log write failure when installing port for the first time (#10287)
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 93b12f391..f6c310415 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -525,8 +525,14 @@ namespace vcpkg::Build #else
const auto& env = System::get_clean_environment();
#endif
- auto stdoutlog =
- paths.buildtrees / action.spec.name() / ("stdout-" + action.spec.triplet().canonical_name() + ".log");
+ auto buildpath = paths.buildtrees / action.spec.name();
+ if (!fs.exists(buildpath))
+ {
+ std::error_code err;
+ fs.create_directory(buildpath, err);
+ Checks::check_exit(VCPKG_LINE_INFO, !err.value(), "Failed to create directory '%s', code: %d", buildpath.u8string(), err.value());
+ }
+ auto stdoutlog = buildpath / ("stdout-" + action.spec.triplet().canonical_name() + ".log");
std::ofstream out_file(stdoutlog.native().c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
Checks::check_exit(VCPKG_LINE_INFO, out_file, "Failed to open '%s' for writing", stdoutlog.u8string());
const int return_code = System::cmd_execute_and_stream_data(
|
