Merge pull request #1274 from docker/fix-json-streams

Fix errors due to json streams over sockets
This commit is contained in:
Jeffrey Morgan 2015-12-04 14:09:09 -08:00
Родитель 548fefc508 262a9cda37
Коммит b162d6bd51
2 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -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;