Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when WSL users don't have Java #1717

Merged
merged 5 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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, do you have java installed?`
samtstern marked this conversation as resolved.
Show resolved Hide resolved
);
}

_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