cmTryRunCommand.cxx 21 KB

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