Skip to content

Commit

Permalink
Warn when WSL users don't have Java (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Oct 11, 2019
1 parent 3368790 commit 45a9a8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* Added support for managing the Realtime Database setting `strictTriggerValidation`.
* Fixes trigger parser to not rely on prototype methods (#1687).
* Fixes bug where standalone CLI would hang in the Android Studio integrated terminal.
* Fixes a bug where accessing refs from background function arguments would point to prod (#1682).
* Fixes a bug where accessing refs from background function arguments would point to prod (#1682).
* Fixes a bug where WSL users without java would get an uncaught exception (#1713).
21 changes: 17 additions & 4 deletions src/serve/javaEmulators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,25 @@ async function _runBinary(
): Promise<void> {
return new Promise((resolve) => {
emulator.stdout = fs.createWriteStream(_getLogFileName(emulator.name));
emulator.instance = childProcess.spawn(command.binary, command.args, {
stdio: ["inherit", "pipe", "pipe"],
});
try {
emulator.instance = childProcess.spawn(command.binary, command.args, {
stdio: ["inherit", "pipe", "pipe"],
});
} catch (e) {
if (e.code === "EACCES") {
// Known issue when WSL users don't have java
// https://github.com/Microsoft/WSL/issues/3886
utils.logLabeledWarning(
emulator.name,
`Could not spawn child process for emulator, check that java is installed and on your $PATH.`
);
}

_fatal(emulator, e);
}

if (emulator.instance == null) {
utils.logWarning(`Could not spawn child process for emulator ${emulator.name}`);
utils.logLabeledWarning(emulator.name, "Could not spawn child process for emulator.");
return;
}

Expand Down

0 comments on commit 45a9a8b

Please sign in to comment.