Skip to content

Commit

Permalink
Fix parsing of result message in uploadlogs
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Jan 23, 2018
1 parent f73e7bd commit 3877f2a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/vs/code/electron-main/logUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,22 @@ async function postLogs(
throw e;
}

try {
return JSON.parse(result.stream.toString());
} catch (e) {
console.log(localize('parseError', 'Error parsing response'));
throw e;
}
return new TPromise<PostResult>((res, reject) => {
const parts: Buffer[] = [];
result.stream.on('data', data => {
parts.push(data);
});

result.stream.on('end', () => {
try {
const result = Buffer.concat(parts).toString('utf-8');
res(JSON.parse(result));
} catch (e) {
console.log(localize('parseError', 'Error parsing response'));
reject(e);
}
});
});
}

function zipLogs(
Expand Down

0 comments on commit 3877f2a

Please sign in to comment.