Fix errors due to json streams over sockets

Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Jeffrey Morgan 2015-12-04 13:59:30 -08:00
parent f8746f4d66
commit 262a9cda37
2 changed files with 4 additions and 6 deletions

View File

@ -22,6 +22,7 @@
"license": "Apache-2.0",
"electron-version": "0.33.9",
"dependencies": {
"JSONStream": "^1.0.7",
"alt": "^0.16.2",
"ansi-to-html": "0.3.0",
"any-promise": "^0.1.0",

View File

@ -10,6 +10,7 @@ import metrics from '../utils/MetricsUtil';
import containerServerActions from '../actions/ContainerServerActions';
import rimraf from 'rimraf';
import stream from 'stream';
import JSONStream from 'JSONStream';
export default {
host: null,
@ -446,9 +447,7 @@ export default {
}
stream.setEncoding('utf8');
stream.on('data', json => {
let data = JSON.parse(json);
stream.pipe(JSONStream.parse()).on('data', data => {
if (data.status === 'pull' || data.status === 'untag' || data.status === 'delete' || data.status === 'attach') {
return;
}
@ -509,9 +508,7 @@ export default {
let error = null;
// data is associated with one layer only (can be identified with id)
stream.on('data', str => {
var data = JSON.parse(str);
stream.pipe(JSONStream.parse()).on('data', data => {
if (data.error) {
error = data.error;
return;