MCPcopy Create free account
hub / github.com/apache/mesos / sha512

Function sha512

src/common/command_utils.cpp:172–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171
172Future<string> sha512(const Path& input)
173{
174#ifdef __linux__
175 const string cmd = "sha512sum";
176 vector<string> argv = {
177 cmd,
178 input // Input file to compute shasum.
179 };
180#else
181 const string cmd = "shasum";
182 vector<string> argv = {
183 cmd,
184 "-a", "512", // Shasum type.
185 input // Input file to compute shasum.
186 };
187#endif // __linux__
188
189 return launch(cmd, argv)
190 .then([cmd](const string& output) -> Future<string> {
191 vector<string> tokens = strings::tokenize(output, " ");
192 if (tokens.size() < 2) {
193 return Failure(
194 "Failed to parse '" + output + "' from '" + cmd + "' command");
195 }
196
197 // TODO(jojy): Check the size of tokens[0].
198
199 return tokens[0];
200 });
201}
202
203
204Future<Nothing> gzip(const Path& input)

Callers 2

fetchMethod · 0.85

Calls 5

tokenizeFunction · 0.85
FailureClass · 0.85
launchFunction · 0.70
thenMethod · 0.45
sizeMethod · 0.45

Tested by 1