From a0b396cf730094a1db47989bc847192ab780db09 Mon Sep 17 00:00:00 2001 From: Robert Chiras Date: Fri, 13 May 2016 10:32:03 +0300 Subject: [PATCH 1/2] build: fix target_arch variables from GYP_DEFINES In case of x86 arch, the target_arch variables passed through GYP_DEFINES is also x86. But, this value is not recognized by gyp files, so we need to pass ia32 instead. For x86 arch, we need to pass the value of DEST_CPU, which is ia32. Signed-off-by: Robert Chiras --- android-configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android-configure b/android-configure index 1dc238ebd0c522..3190b0b914e9da 100755 --- a/android-configure +++ b/android-configure @@ -51,9 +51,9 @@ export CC=$TOOLCHAIN/bin/$SUFFIX-gcc export CXX=$TOOLCHAIN/bin/$SUFFIX-g++ export LINK=$TOOLCHAIN/bin/$SUFFIX-g++ -GYP_DEFINES="target_arch=$ARCH" -GYP_DEFINES+=" v8_target_arch=$ARCH" -GYP_DEFINES+=" android_target_arch=$ARCH" +GYP_DEFINES="target_arch=$DEST_CPU" +GYP_DEFINES+=" v8_target_arch=$DEST_CPU" +GYP_DEFINES+=" android_target_arch=$DEST_CPU" GYP_DEFINES+=" host_os=linux OS=android" export GYP_DEFINES From 467002211d57097de30fed6702610eb591ac96e2 Mon Sep 17 00:00:00 2001 From: Robert Chiras Date: Fri, 13 May 2016 10:39:05 +0300 Subject: [PATCH 2/2] child_process: verify buffer when writing to strerr In execSync/execFileSync commands, we better verify the stderr buffer from ret. In case of other exceptions thrown by spawnSync this buffer might be null. If we don't check it and try to write it to process.stderr we will end up throwing an irrelevant exception from Socket.write, masking the initial exception which might show what is actually wrong with spawnSync. Such an exception was hidden, when running this test on Android. The exception was about '/bin/sh' not found, since in Android, sh can be found in '/system/bin/sh'. Signed-off-by: Robert Chiras --- lib/child_process.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/child_process.js b/lib/child_process.js index 81fb8c1fcd0fe8..1541baf64660b6 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -484,7 +484,7 @@ function execFileSync(/*command, args, options*/) { var ret = spawnSync(opts.file, opts.args.slice(1), opts.options); - if (inheritStderr) + if (inheritStderr && ret.stderr) process.stderr.write(ret.stderr); var err = checkExecSyncError(ret); @@ -504,7 +504,7 @@ function execSync(command /*, options*/) { var ret = spawnSync(opts.file, opts.options); ret.cmd = command; - if (inheritStderr) + if (inheritStderr && ret.stderr) process.stderr.write(ret.stderr); var err = checkExecSyncError(ret);