MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / TempPath

Function TempPath

src/ipc/test/ipc_test.cpp:40–50  ·  view source on GitHub ↗

Generate a temporary path with temp_directory_path and mkstemp

Source from the content-addressed store, hash-verified

38
39//! Generate a temporary path with temp_directory_path and mkstemp
40static std::string TempPath(std::string_view pattern)
41{
42 std::string temp{fs::PathToString(fs::path{fs::temp_directory_path()} / fs::PathFromString(std::string{pattern}))};
43 temp.push_back('\0');
44 int fd{mkstemp(temp.data())};
45 BOOST_CHECK_GE(fd, 0);
46 BOOST_CHECK_EQUAL(close(fd), 0);
47 temp.resize(temp.size() - 1);
48 fs::remove(fs::PathFromString(temp));
49 return temp;
50}
51
52//! Unit test that tests execution of IPC calls without actually creating a
53//! separate process. This test is primarily intended to verify behavior of type

Callers 1

IpcSocketTestFunction · 0.85

Calls 6

PathToStringFunction · 0.85
PathFromStringFunction · 0.85
push_backMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected