From 8d9a30cc821c85b5310c4aa3f1b068dfb4eac2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JC=20P=C3=A9rez=20Chavez?= Date: Mon, 2 Nov 2026 11:45:39 -0800 Subject: [PATCH] Remove $FlowExpectedError[sketchy-null-string] (utils.js) (#59765) Summary: Replace `commandResult.stdout || '(empty)'` and `commandResult.stderr || '(empty)'` with explicit null-or-empty checks, and remove their `$FlowExpectedError[sketchy-null-string]` suppressions. Both fields are `?string`. `x || '(empty)'` falls back only for `undefined`, `null` and `''`; `x == null || x === '' ? '(empty)' : x` falls back for exactly those values and keeps every other string, including whitespace. The header line, `stdout` and `stderr` are each read once, in the original order. Changelog: [Internal] Differential Revision: D128806028 --- private/react-native-fantom/runner/utils.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/private/react-native-fantom/runner/utils.js b/private/react-native-fantom/runner/utils.js index d7a75e8e0e5f..3c23536eff09 100644 --- a/private/react-native-fantom/runner/utils.js +++ b/private/react-native-fantom/runner/utils.js @@ -268,16 +268,18 @@ export function getDebugInfoFromCommandResult( ? 'succeeded' : `failed (status code: ${commandResult.status ?? '(empty)'}${maybeSignal})`; + const commandLine = `Command ${resultByStatus}: ${commandResult.originalCommand}`; + const stdout = commandResult.stdout; + const stderr = commandResult.stderr; + const logLines = [ - `Command ${resultByStatus}: ${commandResult.originalCommand}`, + commandLine, '', 'stdout:', - // $FlowExpectedError[sketchy-null-string] - commandResult.stdout || '(empty)', + stdout == null || stdout === '' ? '(empty)' : stdout, '', 'stderr:', - // $FlowExpectedError[sketchy-null-string] - commandResult.stderr || '(empty)', + stderr == null || stderr === '' ? '(empty)' : stderr, ]; if (commandResult.error) {