12
12
#include < vcpkg/base/system.process.h>
13
13
#include < vcpkg/base/system.proxy.h>
14
14
#include < vcpkg/base/util.h>
15
+ #include < vcpkg/base/uuid.h>
15
16
16
17
#include < vcpkg/commands.version.h>
17
18
#include < vcpkg/metrics.h>
@@ -521,7 +522,8 @@ namespace vcpkg
521
522
return ret;
522
523
}
523
524
524
- bool send_snapshot_to_api (const std::string& github_token,
525
+ bool send_snapshot_to_api (const Filesystem& fs,
526
+ const std::string& github_token,
525
527
const std::string& github_repository,
526
528
const Json::Object& snapshot)
527
529
{
@@ -538,7 +540,13 @@ namespace vcpkg
538
540
cmd.string_arg (" -H" ).string_arg (" X-GitHub-Api-Version: 2022-11-28" );
539
541
cmd.string_arg (
540
542
Strings::concat (" https://api.github.com/repos/" , github_repository, " /dependency-graph/snapshots" ));
541
- cmd.string_arg (" -d" ).string_arg (Json::stringify (snapshot));
543
+
544
+ const auto tmp_dir = fs.create_or_get_temp_directory (VCPKG_LINE_INFO);
545
+ const auto unique_file_name = fmt::format (" dependency_snapshot_{}.json" , generate_random_UUID ());
546
+ const auto snapshot_file_path = tmp_dir / unique_file_name;
547
+ fs.write_contents (snapshot_file_path, Json::stringify (snapshot), VCPKG_LINE_INFO);
548
+
549
+ cmd.string_arg (" -d" ).string_arg (fmt::format (" @{}" , snapshot_file_path));
542
550
int code = 0 ;
543
551
auto result = cmd_execute_and_stream_lines (cmd, [&code](StringView line) {
544
552
if (Strings::starts_with (line, guid_marker))
0 commit comments