From 24a9ef7384b776ff0ab75be043e934591bb8d319 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 31 Aug 2021 09:51:58 -0700 Subject: [PATCH] Suppressing bad file descriptor errors on native builds Summary: When running native builds, we experience a lot of bad file descriptor warnings. This diff is suppressing the issue on local builds (on Mac). Changelog: [Internal] [Changed] - Suppressed bad file descriptor on native builds Reviewed By: ShikaSD Differential Revision: D30487098 fbshipit-source-id: 8199fb8f2f18d19543d2861f1f2f852fff6ae73b --- ReactAndroid/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index edadad219f3..8db3196c6bc 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -362,7 +362,8 @@ def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) { inputs.dir("src/main/java/com/facebook/react/turbomodule/core/jni") inputs.dir("src/main/java/com/facebook/react/modules/blob") outputs.dir("$buildDir/react-ndk/all") - commandLine(getNdkBuildFullPath(), + def commandLineArgs = [ + getNdkBuildFullPath(), "APP_ABI=${reactNativeArchitectures()}", "NDK_DEBUG=" + (nativeBuildType.equalsIgnoreCase("debug") ? "1" : "0"), "NDK_PROJECT_PATH=null", @@ -375,7 +376,12 @@ def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) { "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", "-C", file("src/main/jni/react/jni").absolutePath, "--jobs", project.findProperty("jobs") ?: Runtime.runtime.availableProcessors() - ) + ] + if (Os.isFamily(Os.FAMILY_MAC)) { + // This flag will suppress "fcntl(): Bad file descriptor" warnings on local builds. + commandLineArgs.add("--output-sync=none") + } + commandLine(commandLineArgs) } def cleanReactNdkLib = tasks.register("cleanReactNdkLib", Exec) {