firebase / firebase/firebase-tools
flag --export-on-exit fails when script is terminated with CTRL+C
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [REQUIRED] Environment info
**firebase-tools:** `11.4.0`
**Platform:** `macOS`
### [REQUIRED] Test case
run the following command in your terminal:
`firebase emulators:exec "sleep 20" --ui --only firestore --export-on-exit=./firebase-data`
once the script enters the sleep phase (you have 20 seconds) hit CTRL+C to kill the script.
### [REQUIRED] Steps to reproduce
1. Install firebase-tools globally
2. run `firebase emulators:exec "sleep 20" --ui --only firestore --export-on-exit=./firebase-data`
3. wait for the sleep command to be triggered
4. hit CTRL+C to kill the emulators
### [REQUIRED] Expected behavior
The emulator data should be successfully exported to `./firebase-data`
### [REQUIRED] Actual behavior
The export fails as the emulator is killed before there is a chance for the export to complete.
This is the log:
```
i emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i Automatically exporting data using --export-on-exit "./firebase-data" please wait for the export to finish...
⚠ Script exited with signal: SIGINT
i Found running emulator hub for project test-project at http://localhost:4400
i Creating export directory /path/to/firebase-data
i Exporting data to: /path/to/firebase-data
i emulators: Received export request. Exporting data to /path/to/firebase-data.
i emulators: Shutting down emulators.
i ui: Stopping Emulator UI
⚠ Emulator UI has exited upon receiving signal: SIGINT
i firestore: Stopping Firestore Emulator
⚠ emulators: Export failed: Failed to make request to http://0.0.0.0:8080/emulator/v1/projects/test-project:export
⚠ Export request failed, see emulator logs for more information.
⚠ Automatic export to "./firebase-data" failed, going to exit now...
i emulators: Shutting down emulators.
i firestore: Stopping Firestore Emulator
i hub: Stopping emulator hub
i hub: Stopping emulator hub
i logging: Stopping Logging Emulator
```
Contributor guide
Assessment
This issue has not been assessed yet.