From 9337c7d2b5e5e7210c8e04573f24ba3bb13fe98b Mon Sep 17 00:00:00 2001
From: Francesco Colamonici <fr-esco@users.noreply.github.com>
Date: Fri, 7 Oct 2022 15:32:18 +0200
Subject: [PATCH 1/2] fix(schematics): deploy - give child processes proper
 access to env vars (#3098)

---
 src/schematics/deploy/actions.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/schematics/deploy/actions.ts b/src/schematics/deploy/actions.ts
index 88889b984..ff8acf7e6 100644
--- a/src/schematics/deploy/actions.ts
+++ b/src/schematics/deploy/actions.ts
@@ -31,6 +31,7 @@ const spawnAsync = async (
 ) =>
   new Promise<Buffer>((resolve, reject) => {
     const [spawnCommand, ...args] = command.split(/\s+/);
+    options = { ...(options || {}), shell: true };
     const spawnProcess = spawn(spawnCommand, args, options);
     const chunks: Buffer[] = [];
     const errorChunks: Buffer[] = [];

From 6836b4dd0936c4e65beef31a134f726bf27401ba Mon Sep 17 00:00:00 2001
From: Francesco Colamonici <fr-esco@users.noreply.github.com>
Date: Fri, 7 Oct 2022 15:35:43 +0200
Subject: [PATCH 2/2] fix(schematics): deploy - fix path to main.js (#3098)

---
 src/schematics/deploy/actions.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/schematics/deploy/actions.ts b/src/schematics/deploy/actions.ts
index ff8acf7e6..7e79451d0 100644
--- a/src/schematics/deploy/actions.ts
+++ b/src/schematics/deploy/actions.ts
@@ -314,7 +314,8 @@ export const deployToCloudRun = async (
   fsHost.copySync(staticOut, newStaticOut);
   fsHost.copySync(serverOut, newServerOut);
 
-  const packageJson = getPackageJson(context, workspaceRoot, options, join(serverBuildOptions.outputPath, 'main.js'));
+  // Target runtime is Linux based.
+  const packageJson = getPackageJson(context, workspaceRoot, options, [serverBuildOptions.outputPath, 'main.js'].join('/'));
   const nodeVersion = packageJson.engines.node;
 
   if (!satisfies(process.versions.node, nodeVersion.toString())) {