Skip to content

Commit 60296a3

Browse files
bnoordhuisBridgeAR
authored andcommitted
lib: make tick processor detect xcodebuild errors
`node --prof-process` on macOS calls out to nm(1) to look up C++ symbols. If Xcode hasn't been properly installed or its license hasn't been accepted yet, it prints out an error and exits. Before this commit, that error was swallowed and the output of the tick processor was not showing the C++ entry points. This commit detects that error message and turns it into an exception. No regression test because this particular condition is hard to test for without going to extreme lengths to mock the output of nm. Fixes: #29804 PR-URL: #29830 Reviewed-By: David Carlier <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 600478a commit 60296a3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/internal/v8_prof_polyfill.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ const os = {
4848
}
4949
let out = cp.spawnSync(name, args).stdout.toString();
5050
// Auto c++filt names, but not [iItT]
51-
if (process.platform === 'darwin' && name === 'nm')
51+
if (process.platform === 'darwin' && name === 'nm') {
52+
// nm prints an error along the lines of "Run xcodebuild -license" and
53+
// exits when Xcode hasn't been properly installed or when its license
54+
// hasn't been accepted yet. Basically any mention of xcodebuild in
55+
// the output means the nm command is non-functional.
56+
const match = out.match(/(?:^|\n)([^\n]*xcodebuild[^\n]*)(?:\n|$)/);
57+
if (match) throw new Error(match[1]);
5258
out = macCppfiltNm(out);
59+
}
5360
return out;
5461
}
5562
};

0 commit comments

Comments
 (0)