MCPcopy Create free account
hub / github.com/Kitware/CMake / cmExecuteProcessCommand

Function cmExecuteProcessCommand

Source/cmExecuteProcessCommand.cxx:69–556  ·  view source on GitHub ↗

cmExecuteProcessCommand

Source from the content-addressed store, hash-verified

67
68// cmExecuteProcessCommand
69bool cmExecuteProcessCommand(std::vector<std::string> const& args,
70 cmExecutionStatus& status)
71{
72 if (args.empty()) {
73 status.SetError("called with incorrect number of arguments");
74 return false;
75 }
76
77 struct Arguments : public ArgumentParser::ParseResult
78 {
79 std::vector<std::vector<std::string>> Commands;
80 std::string OutputVariable;
81 std::string ErrorVariable;
82 std::string ResultVariable;
83 std::string ResultsVariable;
84 std::string WorkingDirectory;
85 std::string InputFile;
86 std::string OutputFile;
87 std::string ErrorFile;
88 std::string Timeout;
89 std::string CommandEcho;
90 bool OutputQuiet = false;
91 bool ErrorQuiet = false;
92 bool OutputStripTrailingWhitespace = false;
93 bool ErrorStripTrailingWhitespace = false;
94 bool EchoOutputVariable = false;
95 bool EchoErrorVariable = false;
96 cm::optional<std::string> Encoding;
97 std::string CommandErrorIsFatal;
98 };
99
100 static auto const parser =
101 cmArgumentParser<Arguments>{}
102 .Bind("COMMAND"_s, &Arguments::Commands)
103 .Bind("COMMAND_ECHO"_s, &Arguments::CommandEcho)
104 .Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable)
105 .Bind("ERROR_VARIABLE"_s, &Arguments::ErrorVariable)
106 .Bind("RESULT_VARIABLE"_s, &Arguments::ResultVariable)
107 .Bind("RESULTS_VARIABLE"_s, &Arguments::ResultsVariable)
108 .Bind("WORKING_DIRECTORY"_s, &Arguments::WorkingDirectory)
109 .Bind("INPUT_FILE"_s, &Arguments::InputFile)
110 .Bind("OUTPUT_FILE"_s, &Arguments::OutputFile)
111 .Bind("ERROR_FILE"_s, &Arguments::ErrorFile)
112 .Bind("TIMEOUT"_s, &Arguments::Timeout)
113 .Bind("OUTPUT_QUIET"_s, &Arguments::OutputQuiet)
114 .Bind("ERROR_QUIET"_s, &Arguments::ErrorQuiet)
115 .Bind("OUTPUT_STRIP_TRAILING_WHITESPACE"_s,
116 &Arguments::OutputStripTrailingWhitespace)
117 .Bind("ERROR_STRIP_TRAILING_WHITESPACE"_s,
118 &Arguments::ErrorStripTrailingWhitespace)
119 .Bind("ENCODING"_s, &Arguments::Encoding)
120 .Bind("ECHO_OUTPUT_VARIABLE"_s, &Arguments::EchoOutputVariable)
121 .Bind("ECHO_ERROR_VARIABLE"_s, &Arguments::EchoErrorVariable)
122 .Bind("COMMAND_ERROR_IS_FATAL"_s, &Arguments::CommandErrorIsFatal);
123
124 std::vector<std::string> unparsedArguments;
125 Arguments arguments = parser.Parse(args, &unparsedArguments);
126

Callers

nothing calls this directly

Calls 15

FopenCLOEXECFunction · 0.85
cmUVStreamReadFunction · 0.85
to_stringFunction · 0.85
MaybeReportErrorMethod · 0.80
CanIWriteThisFileMethod · 0.80
c_strMethod · 0.80
GetLoopMethod · 0.80
OutputStreamMethod · 0.80
ErrorStreamMethod · 0.80
DecodeTextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…