Skip to content

Commit

Permalink
fix(GUI): don't ignore any robot message from the CLI (#1026)
Browse files Browse the repository at this point in the history
We recently sent a PR to handle multiple buffered IPC messages being
reported as a single message, confusing `JSON.parse()` in
`lib/shared/child-writer/index.js`, by only sending the last message,
and ignoring the rest, under the assumption that the loss of some state
messages is not critical for the application and the writing process to
work property.

As @lurch pointed out, however, a buffer set of messages might contain
an error object somewhere, and by ignoring all but the last message, we
ignore any error that happened in the way.

See: #898
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
  • Loading branch information
Juan Cruz Viotti authored Jan 13, 2017
1 parent 0f2cba3 commit e8c4589
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/shared/child-writer/writer-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ return isElevated().then((elevated) => {
// causing several progress lines to come up at once as single message.
// Trying to parse multiple JSON objects separated by new lines will
// of course make the parser confused, causing errors later on.
// As a solution, we only consider the last message.
const object = _.last(utils.splitObjectLines(data.toString()));
ipc.of[process.env.IPC_SERVER_ID].emit('message', object);
_.each(utils.splitObjectLines(data.toString()), (object) => {
ipc.of[process.env.IPC_SERVER_ID].emit('message', object);
});

};

Expand Down

0 comments on commit e8c4589

Please sign in to comment.