From ca2124b63c344049115a0b445c470117197ba4fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Tue, 9 Oct 2018 03:08:43 +0000 Subject: [PATCH] Bug 1414383 - Return an error if nm requires xcode license to be accepted during symbolication r=mstange Differential Revision: https://phabricator.services.mozilla.com/D8037 --HG-- extra : moz-landing-system : lando --- .../extensions/parent/ext-geckoProfiler.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/browser/components/extensions/parent/ext-geckoProfiler.js b/browser/components/extensions/parent/ext-geckoProfiler.js index def6ded61f45..cc2058b12901 100644 --- a/browser/components/extensions/parent/ext-geckoProfiler.js +++ b/browser/components/extensions/parent/ext-geckoProfiler.js @@ -91,6 +91,7 @@ const spawnProcess = async function(name, cmdArgs, processData, stdin = null) { } await readAllData(proc.stdout, processData); + return proc.exitCode; }; const runCommandAndGetOutputAsString = async function(command, cmdArgs) { @@ -113,7 +114,13 @@ const getSymbolsFromNM = async function(path, arch) { args.unshift("-arch", arch); } - await spawnProcess("nm", args, data => parser.consume(data)); + const exitCode = await spawnProcess("nm", args, data => parser.consume(data)); + if (exitCode === 69) { + throw new ExtensionError("Symbolication requires the Xcode command line tools to be installed " + + "and the license accepted. Please run the following from the command " + + "line to accept the xcode license:\n\n" + + "sudo xcodebuild -license"); + } if (Services.appinfo.OS !== "Darwin") { // Darwin nm does not support the -D option. await spawnProcess("nm", ["-D", ...args], data => parser.consume(data)); @@ -410,12 +417,16 @@ this.geckoProfiler = class extends ExtensionAPI { } catch (e) { // Each of our options can go wrong for a variety of reasons, so on failure // we will try the next one. + // But we should still throw the explicit ExtensionErrors if there are any. // "localBreakpad" will fail if this is not a local build that's running from the object // directory or if the user hasn't run `mach buildsymbols` on it. // "nm" will fail if `nm` is not available. // "dump_syms.exe" will fail if this is not a local build that's running from the object // directory, or if dump_syms.exe doesn't exist in the object directory, or if // dump_syms.exe failed for other reasons. + if (e instanceof ExtensionError) { + throw e; + } } }