From 004ff78b10eef3ba0efeabc33cd5d820f0046ab8 Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Fri, 6 Dec 2024 20:28:16 +0530 Subject: [PATCH] Fix EINVAL error while running spawning .bat binaries on Windows. Ref: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 --- src/commands/android/utils/sdk.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/android/utils/sdk.ts b/src/commands/android/utils/sdk.ts index a7b26cc..4545a9a 100644 --- a/src/commands/android/utils/sdk.ts +++ b/src/commands/android/utils/sdk.ts @@ -233,7 +233,10 @@ export const spawnCommandSync = (binaryLocation: string, binaryName: string, pla cmd = binaryLocation; } - const result = spawnSync(cmd, args, {stdio: 'inherit'}); + const result = spawnSync(cmd, args, { + stdio: 'inherit', + ...(platform === 'windows' && cmd.endsWith('.bat') && {shell: true}) + }); if (result.error) { console.error(result.error);