From 3268a50de2d9e32df710b5542f4727c1fa555084 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 5 Jul 2019 17:50:17 +0500 Subject: [PATCH] fix: autolinking bug on Windows when reading config (#480) --- packages/platform-android/native_modules.gradle | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 4bd826f76f..fcfaa78939 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -167,18 +167,23 @@ class ReactNativeModules { def cmdProcess def root = getReactNativeProjectRoot() - def command = "./node_modules/.bin/react-native config" - + def command = "node ./node_modules/react-native/cli.js config" + def reactNativeConfigOutput = "" + try { cmdProcess = Runtime.getRuntime().exec(command, null, root) - cmdProcess.waitFor() + def inputStreamReader = new InputStreamReader(cmdProcess.getInputStream()) + def bufferedReader = new BufferedReader(inputStreamReader) + def line = null + while ((line = bufferedReader.readLine()) != null){ + reactNativeConfigOutput += line + } } catch (Exception exception) { this.logger.warn("${LOG_PREFIX}${exception.message}") this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.") return reactNativeModules } - def reactNativeConfigOutput = cmdProcess.in.text def json = new JsonSlurper().parseText(reactNativeConfigOutput) this.packageName = json["project"]["android"]["packageName"] def dependencies = json["dependencies"]