Skip to content

Commit 56fb8a3

Browse files
authored
Fix Python Functions error when path has spaces (#5831)
Proposed fix for #5830 Issue seems to be caused by [spawn](https://github.com/firebase/firebase-tools/blob/f8f19dc060e6daf060b87d38fd2a38d24bab8210/src/functions/python.ts#L38) raising an error when path provided has spaces. Might be related to nodejs/node#38490. ### Scenarios Tested Similar to steps provided in #5830 1. Run `mkdir 'i like spaces'` 2. Run `cd i\ like\ spaces` or `cd 'i like spaces'` 3. Run `firebase init functions --project <project_id>` 1. Select `Python` 2. Do you want to install dependencies now? Yes 4. Run `cd functions` 5. Run `firebase emulators:start` 1. Emulators start with no issues 7. Uncomment code in `main.py` to deploy 8. Run `firebase deploy --only functions` 1. Functions deployed with no issues ### Sample Commands `firebase emulators:start` && `firebase deploy --only functions`
1 parent f8f19dc commit 56fb8a3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
- Fixes an issue in the EventArc emualtor where events missing optional fields would cause crashes. (#5803)
2+
- Fixes an issue running `firebase emulators:start` and `firebase deploy` when Python Cloud Functions directory path has spaces. (#5830)

src/functions/python.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const DEFAULT_VENV_DIR = "venv";
1414
export function virtualEnvCmd(cwd: string, venvDir: string): { command: string; args: string[] } {
1515
const activateScriptPath =
1616
process.platform === "win32" ? ["Scripts", "activate.bat"] : ["bin", "activate"];
17-
const venvActivate = path.join(cwd, venvDir, ...activateScriptPath);
17+
const venvActivate = `"${path.join(cwd, venvDir, ...activateScriptPath)}"`;
1818
return {
1919
command: process.platform === "win32" ? venvActivate : ".",
2020
args: [process.platform === "win32" ? "" : venvActivate],

0 commit comments

Comments
 (0)