Skip to content

Commit 647c890

Browse files
authored
Use unique identifier to match return codes in the output (#804)
1 parent af43b2a commit 647c890

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vcpkg/base/system.process.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,9 @@ namespace vcpkg
890890
Encoding encoding)
891891
{
892892
const ElapsedTimer timer;
893+
static std::atomic_int32_t id_counter{1000};
894+
const auto id = Strings::format("%4i", id_counter.fetch_add(1, std::memory_order_relaxed));
893895
#if defined(_WIN32)
894-
const auto proc_id = std::to_string(::GetCurrentProcessId());
895896
using vcpkg::g_ctrl_c_state;
896897

897898
g_ctrl_c_state.transition_to_spawn_process();
@@ -902,7 +903,6 @@ namespace vcpkg
902903
g_ctrl_c_state.transition_from_spawn_process();
903904
#else // ^^^ _WIN32 // !_WIN32 vvv
904905
Checks::check_exit(VCPKG_LINE_INFO, encoding == Encoding::Utf8);
905-
const auto proc_id = std::to_string(::getpid());
906906

907907
std::string actual_cmd_line;
908908
if (wd.working_directory.empty())
@@ -920,7 +920,7 @@ namespace vcpkg
920920
.extract();
921921
}
922922

923-
Debug::print(proc_id, ": popen(", actual_cmd_line, ")\n");
923+
Debug::print(id, ": popen(", actual_cmd_line, ")\n");
924924
// Flush stdout before launching external process
925925
fflush(stdout);
926926

@@ -963,7 +963,7 @@ namespace vcpkg
963963
g_subprocess_stats += elapsed;
964964
if (const auto pec = exit_code.get())
965965
{
966-
Debug::print(proc_id,
966+
Debug::print(id,
967967
": cmd_execute_and_stream_data() returned ",
968968
*pec,
969969
" after ",

0 commit comments

Comments
 (0)