From f599e2a613d7f9e8a1194a86823a5746dbd60d5e Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Thu, 25 Sep 2025 02:29:11 -0700 Subject: [PATCH] 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 --- packages/debugger-shell/src/node/index.flow.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/debugger-shell/src/node/index.flow.js b/packages/debugger-shell/src/node/index.flow.js index 449744ee5e1..7c4e06831c5 100644 --- a/packages/debugger-shell/src/node/index.flow.js +++ b/packages/debugger-shell/src/node/index.flow.js @@ -116,16 +116,12 @@ async function unstable_prepareDebuggerShell( flavor: DebuggerShellFlavor, {prebuiltBinaryPath}: {prebuiltBinaryPath?: string} = {}, ): Promise { - 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',