firebase / firebase/firebase-tools

When emulators don't launch the return code should always be non-zero

Open
#4,754 5 comments 0 reactions 1 assignee Claimed by @bkendall View on GitHub
type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

This has been mentioned in some other issues (did not find them..), but still remains at least for this one case.

**Expected behavior**

Whenever there is an error in launching Emulators that causes them to **not** launch, the `firebase emulators:start` command should return with a **non-zero** return code.

This is normal Unix tool behaviour.

**Actual**

With certain errors, `firebase emulators:start` prints an error message but return with a zero return code.

The example is from Docker Compose. If I map things wrong, `firestore-debug.log` is a directory, instead of a file. This confuses the emulators to:

```
Step #2: emul | Launching Docker... 🐳
Step #2: emul | i emulators: Starting emulators: functions, firestore, database
Step #2: emul | ✔ functions: Using node@16 from host.
Step #2: emul | i firestore: Firestore Emulator logging to firestore-debug.log
Step #2: emul |
Step #2: emul | Error: An unexpected error has occurred.
Step #2: emul exited with code 0
```

Note the "exited with code 0".

### [REQUIRED] Environment info

- `firebase-tools` 11.2.1
- Platform: Cloud Build

### [REQUIRED] Test case

- Have an otherwise working Firebase Emulators project
- Create a folder `firebase-debug.log`
- Launch the emulators

At exit, `echo $?` to see the return code.

### [REQUIRED] Expected behavior

If the emulators don't start, `firebase` should return with non-zero code.

### [REQUIRED] Steps to reproduce

see `Test case`

### [REQUIRED] Actual behavior

At least in the above case, it returns with 0.

I wish you have the time to look through the code for any such cases.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.