Fix custom prebuilt binary handling in unstable_prepareDebuggerShell (#53927)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53927

Changelog: [Internal]

Fixes a bug that broke `unstable_prepareDebuggerShell` (and therefore the RNDT shell) in OSS.

Reviewed By: vzaidman

Differential Revision: D83178777

fbshipit-source-id: cfd93b14e2a94e36d8a3ee9f4605036a4279ef8c
This commit is contained in:
Moti Zilberman
2025-09-25 02:29:11 -07:00
committed by Facebook GitHub Bot
parent b577679746
commit f599e2a613
@@ -116,16 +116,12 @@ async function unstable_prepareDebuggerShell(
flavor: DebuggerShellFlavor,
{prebuiltBinaryPath}: {prebuiltBinaryPath?: string} = {},
): Promise<DebuggerShellPreparationResult> {
const [binaryPath, baseArgs] = getShellBinaryAndArgs(
flavor,
prebuiltBinaryPath,
);
try {
switch (flavor) {
case 'prebuilt':
const prebuiltResult =
await prepareDebuggerShellFromDotSlashFile(binaryPath);
const prebuiltResult = await prepareDebuggerShellFromDotSlashFile(
prebuiltBinaryPath ?? DEVTOOLS_BINARY_DOTSLASH_FILE,
);
if (prebuiltResult.code !== 'success') {
return prebuiltResult;
}
@@ -136,6 +132,11 @@ async function unstable_prepareDebuggerShell(
flavor as empty;
throw new Error(`Unknown flavor: ${flavor}`);
}
const [binaryPath, baseArgs] = getShellBinaryAndArgs(
flavor,
prebuiltBinaryPath,
);
const {code, stderr} = await spawnAndGetStderr(binaryPath, [
...baseArgs,
'--version',