Skip to content

Commit

Permalink
Merge pull request #1057 from firebase/rpb/emualtor-fixes
Browse files Browse the repository at this point in the history
Minor fixes to how emulators are downloaded + run
  • Loading branch information
ryanpbrewster committed Dec 7, 2018
2 parents 1a70e45 + 9d0fb43 commit 52613d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/emulator/download.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";

const FirebaseError = require("../error");
const fs = require("fs-extra");
const request = require("request");
const emulatorConstants = require("./constants");
Expand All @@ -13,6 +14,11 @@ module.exports = (name) => {
let req = request.get(emulator.remoteUrl);
let writeStream = fs.createWriteStream(emulator.localPath);
req.on("error", (err) => reject(err));
req.on("response", (response) => {
if (response.statusCode != 200) {
reject(new FirebaseError(`download failed, status ${response.statusCode}`, { exit: 1 }));
}
});
req.on("end", () => {
writeStream.close();
fs.chmodSync(emulator.localPath, 0o755);
Expand Down
3 changes: 1 addition & 2 deletions src/serve/javaEmulators.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function _runBinary(emulator, command) {
stdio: ["inherit", "pipe", "pipe"],
});
emulator.instance.stdout.on("data", (data) => {
console.log(data.toString());
process.stdout.write(data.toString());
emulator.stdout.write(data.toString());
});
emulator.instance.stderr.on("data", (data) => {
Expand Down Expand Up @@ -51,7 +51,6 @@ function _runBinary(emulator, command) {
utils.logLabeledBullet(emulator.name, "emulator has exited");
}
});
utils.logLabeledSuccess(emulator.name, "started on http://localhost:" + emulator.port);
resolve();
});
}
Expand Down

0 comments on commit 52613d1

Please sign in to comment.