cmTryRunCommand.cxx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmTryRunCommand.h"
  4. #include <cstdio>
  5. #include <stdexcept>
  6. #include <cm/optional>
  7. #include <cmext/string_view>
  8. #include "cmsys/FStream.hxx"
  9. #include "cmArgumentParserTypes.h"
  10. #include "cmConfigureLog.h"
  11. #include "cmCoreTryCompile.h"
  12. #include "cmDuration.h"
  13. #include "cmExecutionStatus.h"
  14. #include "cmMakefile.h"
  15. #include "cmMessageType.h"
  16. #include "cmRange.h"
  17. #include "cmState.h"
  18. #include "cmStateTypes.h"
  19. #include "cmStringAlgorithms.h"
  20. #include "cmSystemTools.h"
  21. #include "cmValue.h"
  22. #include "cmake.h"
  23. namespace {
  24. struct cmTryRunResult
  25. {
  26. bool VariableCached = true;
  27. std::string Variable;
  28. cm::optional<std::string> Stdout;
  29. cm::optional<std::string> Stderr;
  30. cm::optional<std::string> ExitCode;
  31. };
  32. #ifndef CMAKE_BOOTSTRAP
  33. void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf,
  34. cmTryCompileResult const& compileResult,
  35. cmTryRunResult const& runResult)
  36. {
  37. // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
  38. static const std::vector<unsigned long> LogVersionsWithTryRunV1{ 1 };
  39. if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) {
  40. log.BeginEvent("try_run-v1", mf);
  41. cmCoreTryCompile::WriteTryCompileEventFields(log, compileResult);
  42. log.BeginObject("runResult"_s);
  43. log.WriteValue("variable"_s, runResult.Variable);
  44. log.WriteValue("cached"_s, runResult.VariableCached);
  45. if (runResult.Stdout) {
  46. log.WriteLiteralTextBlock("stdout"_s, *runResult.Stdout);
  47. }
  48. if (runResult.Stderr) {
  49. log.WriteLiteralTextBlock("stderr"_s, *runResult.Stderr);
  50. }
  51. if (runResult.ExitCode) {
  52. try {
  53. log.WriteValue("exitCode"_s, std::stoi(*runResult.ExitCode));
  54. } catch (std::invalid_argument const&) {
  55. log.WriteValue("exitCode"_s, *runResult.ExitCode);
  56. }
  57. }
  58. log.EndObject();
  59. log.EndEvent();
  60. }
  61. }
  62. #endif
  63. class TryRunCommandImpl : public cmCoreTryCompile
  64. {
  65. public:
  66. TryRunCommandImpl(cmMakefile* mf)
  67. : cmCoreTryCompile(mf)
  68. {
  69. }
  70. bool TryRunCode(std::vector<std::string> const& args);
  71. void RunExecutable(const std::string& runArgs,
  72. cm::optional<std::string> const& workDir,
  73. std::string* runOutputContents,
  74. std::string* runOutputStdOutContents,
  75. std::string* runOutputStdErrContents);
  76. void DoNotRunExecutable(const std::string& runArgs,
  77. cm::optional<std::string> const& srcFile,
  78. std::string const& compileResultVariable,
  79. std::string* runOutputContents,
  80. std::string* runOutputStdOutContents,
  81. std::string* runOutputStdErrContents,
  82. bool stdOutErrRequired);
  83. bool NoCache;
  84. std::string RunResultVariable;
  85. };
  86. bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv)
  87. {
  88. this->RunResultVariable = argv[0];
  89. cmCoreTryCompile::Arguments arguments =
  90. this->ParseArgs(cmMakeRange(argv).advance(1), true);
  91. if (!arguments) {
  92. return true;
  93. }
  94. this->NoCache = arguments.NoCache;
  95. // although they could be used together, don't allow it, because
  96. // using OUTPUT_VARIABLE makes crosscompiling harder
  97. if (arguments.OutputVariable &&
  98. (arguments.CompileOutputVariable || arguments.RunOutputVariable ||
  99. arguments.RunOutputStdOutVariable ||
  100. arguments.RunOutputStdErrVariable)) {
  101. cmSystemTools::Error(
  102. "You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
  103. ", RUN_OUTPUT_VARIABLE, RUN_OUTPUT_STDOUT_VARIABLE or "
  104. "RUN_OUTPUT_STDERR_VARIABLE. "
  105. "Please use only COMPILE_OUTPUT_VARIABLE, RUN_OUTPUT_VARIABLE, "
  106. "RUN_OUTPUT_STDOUT_VARIABLE "
  107. "and/or RUN_OUTPUT_STDERR_VARIABLE.");
  108. return false;
  109. }
  110. if ((arguments.RunOutputStdOutVariable ||
  111. arguments.RunOutputStdErrVariable) &&
  112. arguments.RunOutputVariable) {
  113. cmSystemTools::Error(
  114. "You cannot use RUN_OUTPUT_STDOUT_VARIABLE or "
  115. "RUN_OUTPUT_STDERR_VARIABLE together "
  116. "with RUN_OUTPUT_VARIABLE. Please use only COMPILE_OUTPUT_VARIABLE or "
  117. "RUN_OUTPUT_STDOUT_VARIABLE and/or RUN_OUTPUT_STDERR_VARIABLE.");
  118. return false;
  119. }
  120. if (arguments.RunWorkingDirectory) {
  121. if (!cmSystemTools::MakeDirectory(*arguments.RunWorkingDirectory)) {
  122. cmSystemTools::Error(cmStrCat("Error creating working directory \"",
  123. *arguments.RunWorkingDirectory, "\"."));
  124. return false;
  125. }
  126. }
  127. bool captureRunOutput = false;
  128. if (arguments.OutputVariable) {
  129. captureRunOutput = true;
  130. } else if (arguments.CompileOutputVariable) {
  131. arguments.OutputVariable = arguments.CompileOutputVariable;
  132. }
  133. // Capture the split output for the configure log unless the caller
  134. // requests combined output to be captured by a variable.
  135. bool captureRunOutputStdOutErr = true;
  136. if (!arguments.RunOutputStdOutVariable &&
  137. !arguments.RunOutputStdErrVariable) {
  138. if (arguments.RunOutputVariable) {
  139. captureRunOutput = true;
  140. captureRunOutputStdOutErr = false;
  141. } else if (arguments.OutputVariable) {
  142. captureRunOutputStdOutErr = false;
  143. }
  144. }
  145. // do the try compile
  146. cm::optional<cmTryCompileResult> compileResult =
  147. this->TryCompileCode(arguments, cmStateEnums::EXECUTABLE);
  148. cmTryRunResult runResult;
  149. runResult.Variable = this->RunResultVariable;
  150. runResult.VariableCached = !arguments.NoCache;
  151. // now try running the command if it compiled
  152. if (compileResult && compileResult->ExitCode == 0) {
  153. if (this->OutputFile.empty()) {
  154. cmSystemTools::Error(this->FindErrorMessage);
  155. } else {
  156. std::string runArgs;
  157. if (arguments.RunArgs) {
  158. runArgs = cmStrCat(" ", cmJoin(*arguments.RunArgs, " "));
  159. }
  160. // "run" it and capture the output
  161. std::string runOutputContents;
  162. std::string runOutputStdOutContents;
  163. std::string runOutputStdErrContents;
  164. if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") &&
  165. !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) {
  166. // We only require the stdout/stderr cache entries if the project
  167. // actually asked for the values, not just for logging.
  168. bool const stdOutErrRequired = (arguments.RunOutputStdOutVariable ||
  169. arguments.RunOutputStdErrVariable);
  170. this->DoNotRunExecutable(
  171. runArgs, arguments.SourceDirectoryOrFile,
  172. *arguments.CompileResultVariable,
  173. captureRunOutput ? &runOutputContents : nullptr,
  174. captureRunOutputStdOutErr ? &runOutputStdOutContents : nullptr,
  175. captureRunOutputStdOutErr ? &runOutputStdErrContents : nullptr,
  176. stdOutErrRequired);
  177. } else {
  178. this->RunExecutable(
  179. runArgs, arguments.RunWorkingDirectory,
  180. captureRunOutput ? &runOutputContents : nullptr,
  181. captureRunOutputStdOutErr ? &runOutputStdOutContents : nullptr,
  182. captureRunOutputStdOutErr ? &runOutputStdErrContents : nullptr);
  183. }
  184. if (captureRunOutputStdOutErr) {
  185. runResult.Stdout = runOutputStdOutContents;
  186. runResult.Stderr = runOutputStdErrContents;
  187. } else {
  188. runResult.Stdout = runOutputContents;
  189. }
  190. if (cmValue ec =
  191. this->Makefile->GetDefinition(this->RunResultVariable)) {
  192. runResult.ExitCode = *ec;
  193. }
  194. // now put the output into the variables
  195. if (arguments.RunOutputVariable) {
  196. this->Makefile->AddDefinition(*arguments.RunOutputVariable,
  197. runOutputContents);
  198. }
  199. if (arguments.RunOutputStdOutVariable) {
  200. this->Makefile->AddDefinition(*arguments.RunOutputStdOutVariable,
  201. runOutputStdOutContents);
  202. }
  203. if (arguments.RunOutputStdErrVariable) {
  204. this->Makefile->AddDefinition(*arguments.RunOutputStdErrVariable,
  205. runOutputStdErrContents);
  206. }
  207. if (arguments.OutputVariable && !arguments.CompileOutputVariable) {
  208. // if the TryCompileCore saved output in this outputVariable then
  209. // prepend that output to this output
  210. cmValue compileOutput =
  211. this->Makefile->GetDefinition(*arguments.OutputVariable);
  212. if (compileOutput) {
  213. runOutputContents = *compileOutput + runOutputContents;
  214. }
  215. this->Makefile->AddDefinition(*arguments.OutputVariable,
  216. runOutputContents);
  217. }
  218. }
  219. }
  220. #ifndef CMAKE_BOOTSTRAP
  221. if (compileResult && !arguments.NoLog) {
  222. cmMakefile const& mf = *(this->Makefile);
  223. if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) {
  224. WriteTryRunEvent(*log, mf, *compileResult, runResult);
  225. }
  226. }
  227. #endif
  228. // if we created a directory etc, then cleanup after ourselves
  229. if (!this->Makefile->GetCMakeInstance()->GetDebugTryCompile()) {
  230. this->CleanupFiles(this->BinaryDirectory);
  231. }
  232. return true;
  233. }
  234. void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
  235. cm::optional<std::string> const& workDir,
  236. std::string* out, std::string* stdOut,
  237. std::string* stdErr)
  238. {
  239. int retVal = -1;
  240. std::string finalCommand;
  241. const std::string& emulator =
  242. this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
  243. if (!emulator.empty()) {
  244. std::vector<std::string> emulatorWithArgs = cmExpandedList(emulator);
  245. finalCommand +=
  246. cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
  247. finalCommand += " ";
  248. for (std::string const& arg : cmMakeRange(emulatorWithArgs).advance(1)) {
  249. finalCommand += "\"";
  250. finalCommand += arg;
  251. finalCommand += "\"";
  252. finalCommand += " ";
  253. }
  254. }
  255. finalCommand += cmSystemTools::ConvertToRunCommandPath(this->OutputFile);
  256. if (!runArgs.empty()) {
  257. finalCommand += runArgs;
  258. }
  259. bool worked = cmSystemTools::RunSingleCommand(
  260. finalCommand, stdOut || stdErr ? stdOut : out,
  261. stdOut || stdErr ? stdErr : out, &retVal,
  262. workDir ? workDir->c_str() : nullptr, cmSystemTools::OUTPUT_NONE,
  263. cmDuration::zero());
  264. // set the run var
  265. char retChar[16];
  266. const char* retStr;
  267. if (worked) {
  268. snprintf(retChar, sizeof(retChar), "%i", retVal);
  269. retStr = retChar;
  270. } else {
  271. retStr = "FAILED_TO_RUN";
  272. }
  273. if (this->NoCache) {
  274. this->Makefile->AddDefinition(this->RunResultVariable, retStr);
  275. } else {
  276. this->Makefile->AddCacheDefinition(this->RunResultVariable, retStr,
  277. "Result of try_run()",
  278. cmStateEnums::INTERNAL);
  279. }
  280. }
  281. /* This is only used when cross compiling. Instead of running the
  282. executable, two cache variables are created which will hold the results
  283. the executable would have produced.
  284. */
  285. void TryRunCommandImpl::DoNotRunExecutable(
  286. const std::string& runArgs, cm::optional<std::string> const& srcFile,
  287. std::string const& compileResultVariable, std::string* out,
  288. std::string* stdOut, std::string* stdErr, bool stdOutErrRequired)
  289. {
  290. // copy the executable out of the CMakeFiles/ directory, so it is not
  291. // removed at the end of try_run() and the user can run it manually
  292. // on the target platform.
  293. std::string copyDest =
  294. cmStrCat(this->Makefile->GetHomeOutputDirectory(), "/CMakeFiles/",
  295. cmSystemTools::GetFilenameWithoutExtension(this->OutputFile), '-',
  296. this->RunResultVariable,
  297. cmSystemTools::GetFilenameExtension(this->OutputFile));
  298. cmSystemTools::CopyFileAlways(this->OutputFile, copyDest);
  299. std::string resultFileName =
  300. cmStrCat(this->Makefile->GetHomeOutputDirectory(), "/TryRunResults.cmake");
  301. std::string detailsString = cmStrCat("For details see ", resultFileName);
  302. std::string internalRunOutputName =
  303. this->RunResultVariable + "__TRYRUN_OUTPUT";
  304. std::string internalRunOutputStdOutName =
  305. this->RunResultVariable + "__TRYRUN_OUTPUT_STDOUT";
  306. std::string internalRunOutputStdErrName =
  307. this->RunResultVariable + "__TRYRUN_OUTPUT_STDERR";
  308. bool error = false;
  309. if (!this->Makefile->GetDefinition(this->RunResultVariable)) {
  310. // if the variables doesn't exist, create it with a helpful error text
  311. // and mark it as advanced
  312. std::string comment =
  313. cmStrCat("Run result of try_run(), indicates whether the executable "
  314. "would have been able to run on its target platform.\n",
  315. detailsString);
  316. this->Makefile->AddCacheDefinition(this->RunResultVariable,
  317. "PLEASE_FILL_OUT-FAILED_TO_RUN",
  318. comment.c_str(), cmStateEnums::STRING);
  319. cmState* state = this->Makefile->GetState();
  320. cmValue existingValue = state->GetCacheEntryValue(this->RunResultVariable);
  321. if (existingValue) {
  322. state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
  323. }
  324. error = true;
  325. }
  326. // is the output from the executable used ?
  327. if (stdOutErrRequired) {
  328. if (!this->Makefile->GetDefinition(internalRunOutputStdOutName)) {
  329. // if the variables doesn't exist, create it with a helpful error text
  330. // and mark it as advanced
  331. std::string comment = cmStrCat(
  332. "Output of try_run(), contains the text, which the executable "
  333. "would have printed on stdout on its target platform.\n",
  334. detailsString);
  335. this->Makefile->AddCacheDefinition(
  336. internalRunOutputStdOutName, "PLEASE_FILL_OUT-NOTFOUND",
  337. comment.c_str(), cmStateEnums::STRING);
  338. cmState* state = this->Makefile->GetState();
  339. cmValue existing =
  340. state->GetCacheEntryValue(internalRunOutputStdOutName);
  341. if (existing) {
  342. state->SetCacheEntryProperty(internalRunOutputStdOutName, "ADVANCED",
  343. "1");
  344. }
  345. error = true;
  346. }
  347. if (!this->Makefile->GetDefinition(internalRunOutputStdErrName)) {
  348. // if the variables doesn't exist, create it with a helpful error text
  349. // and mark it as advanced
  350. std::string comment = cmStrCat(
  351. "Output of try_run(), contains the text, which the executable "
  352. "would have printed on stderr on its target platform.\n",
  353. detailsString);
  354. this->Makefile->AddCacheDefinition(
  355. internalRunOutputStdErrName, "PLEASE_FILL_OUT-NOTFOUND",
  356. comment.c_str(), cmStateEnums::STRING);
  357. cmState* state = this->Makefile->GetState();
  358. cmValue existing =
  359. state->GetCacheEntryValue(internalRunOutputStdErrName);
  360. if (existing) {
  361. state->SetCacheEntryProperty(internalRunOutputStdErrName, "ADVANCED",
  362. "1");
  363. }
  364. error = true;
  365. }
  366. } else if (out) {
  367. if (!this->Makefile->GetDefinition(internalRunOutputName)) {
  368. // if the variables doesn't exist, create it with a helpful error text
  369. // and mark it as advanced
  370. std::string comment = cmStrCat(
  371. "Output of try_run(), contains the text, which the executable "
  372. "would have printed on stdout and stderr on its target platform.\n",
  373. detailsString);
  374. this->Makefile->AddCacheDefinition(
  375. internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(),
  376. cmStateEnums::STRING);
  377. cmState* state = this->Makefile->GetState();
  378. cmValue existing = state->GetCacheEntryValue(internalRunOutputName);
  379. if (existing) {
  380. state->SetCacheEntryProperty(internalRunOutputName, "ADVANCED", "1");
  381. }
  382. error = true;
  383. }
  384. }
  385. if (error) {
  386. static bool firstTryRun = true;
  387. cmsys::ofstream file(resultFileName.c_str(),
  388. firstTryRun ? std::ios::out : std::ios::app);
  389. if (file) {
  390. if (firstTryRun) {
  391. /* clang-format off */
  392. file << "# This file was generated by CMake because it detected "
  393. "try_run() commands\n"
  394. "# in crosscompiling mode. It will be overwritten by the next "
  395. "CMake run.\n"
  396. "# Copy it to a safe location, set the variables to "
  397. "appropriate values\n"
  398. "# and use it then to preset the CMake cache (using -C).\n\n";
  399. /* clang-format on */
  400. }
  401. std::string comment =
  402. cmStrCat('\n', this->RunResultVariable,
  403. "\n indicates whether the executable would have been able "
  404. "to run on its\n"
  405. " target platform. If so, set ",
  406. this->RunResultVariable,
  407. " to\n"
  408. " the exit code (in many cases 0 for success), otherwise "
  409. "enter \"FAILED_TO_RUN\".\n");
  410. if (stdOut || stdErr) {
  411. if (stdOut) {
  412. comment += internalRunOutputStdOutName;
  413. comment +=
  414. "\n contains the text the executable "
  415. "would have printed on stdout.\n"
  416. " If the executable would not have been able to run, set ";
  417. comment += internalRunOutputStdOutName;
  418. comment += " empty.\n"
  419. " Otherwise check if the output is evaluated by the "
  420. "calling CMake code. If so,\n"
  421. " check what the source file would have printed when "
  422. "called with the given arguments.\n";
  423. }
  424. if (stdErr) {
  425. comment += internalRunOutputStdErrName;
  426. comment +=
  427. "\n contains the text the executable "
  428. "would have printed on stderr.\n"
  429. " If the executable would not have been able to run, set ";
  430. comment += internalRunOutputStdErrName;
  431. comment += " empty.\n"
  432. " Otherwise check if the output is evaluated by the "
  433. "calling CMake code. If so,\n"
  434. " check what the source file would have printed when "
  435. "called with the given arguments.\n";
  436. }
  437. } else if (out) {
  438. comment += internalRunOutputName;
  439. comment +=
  440. "\n contains the text the executable "
  441. "would have printed on stdout and stderr.\n"
  442. " If the executable would not have been able to run, set ";
  443. comment += internalRunOutputName;
  444. comment += " empty.\n"
  445. " Otherwise check if the output is evaluated by the "
  446. "calling CMake code. If so,\n"
  447. " check what the source file would have printed when "
  448. "called with the given arguments.\n";
  449. }
  450. comment += "The ";
  451. comment += compileResultVariable;
  452. comment += " variable holds the build result for this try_run().\n\n";
  453. if (srcFile) {
  454. comment += "Source file : ";
  455. comment += *srcFile + "\n";
  456. }
  457. comment += "Executable : ";
  458. comment += copyDest + "\n";
  459. comment += "Run arguments : ";
  460. comment += runArgs;
  461. comment += "\n";
  462. comment += " Called from: " + this->Makefile->FormatListFileStack();
  463. cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
  464. file << comment << "\n\n";
  465. file << "set( " << this->RunResultVariable << " \n \""
  466. << this->Makefile->GetSafeDefinition(this->RunResultVariable)
  467. << "\"\n CACHE STRING \"Result from try_run\" FORCE)\n\n";
  468. if (out) {
  469. file << "set( " << internalRunOutputName << " \n \""
  470. << this->Makefile->GetSafeDefinition(internalRunOutputName)
  471. << "\"\n CACHE STRING \"Output from try_run\" FORCE)\n\n";
  472. }
  473. file.close();
  474. }
  475. firstTryRun = false;
  476. std::string errorMessage =
  477. cmStrCat("try_run() invoked in cross-compiling mode, "
  478. "please set the following cache variables "
  479. "appropriately:\n ",
  480. this->RunResultVariable, " (advanced)\n");
  481. if (out) {
  482. errorMessage += " " + internalRunOutputName + " (advanced)\n";
  483. }
  484. errorMessage += detailsString;
  485. cmSystemTools::Error(errorMessage);
  486. return;
  487. }
  488. if (stdOut || stdErr) {
  489. if (stdOut) {
  490. (*stdOut) = *this->Makefile->GetDefinition(internalRunOutputStdOutName);
  491. }
  492. if (stdErr) {
  493. (*stdErr) = *this->Makefile->GetDefinition(internalRunOutputStdErrName);
  494. }
  495. } else if (out) {
  496. (*out) = *this->Makefile->GetDefinition(internalRunOutputName);
  497. }
  498. }
  499. }
  500. bool cmTryRunCommand(std::vector<std::string> const& args,
  501. cmExecutionStatus& status)
  502. {
  503. cmMakefile& mf = status.GetMakefile();
  504. if (args.size() < 4) {
  505. mf.IssueMessage(MessageType::FATAL_ERROR,
  506. "The try_run() command requires at least 4 arguments.");
  507. return false;
  508. }
  509. if (mf.GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
  510. mf.IssueMessage(
  511. MessageType::FATAL_ERROR,
  512. "The try_run() command is not supported in --find-package mode.");
  513. return false;
  514. }
  515. TryRunCommandImpl tr(&mf);
  516. return tr.TryRunCode(args);
  517. }