From 0f5423b8d4e81f02704463fca03a0882d1a598e9 Mon Sep 17 00:00:00 2001 From: davemackintosh Date: Tue, 14 Jul 2015 08:44:03 +0100 Subject: [PATCH] Closes #26 --- lib/create-container.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/create-container.js b/lib/create-container.js index 46085ed..86ad820 100644 --- a/lib/create-container.js +++ b/lib/create-container.js @@ -29,7 +29,18 @@ function pull (docker, image, done) { streamc .pipe(es.map(function (data, cb) { - cb(null, JSON.parse(data)) + var json_data = null + + try { + json_data = JSON.parse(data.toString()) + } catch (error) { + json_data = { + type: 'stdout', + data: data.toString() + } + } + + cb(null, json_data) })) .on('data', function (event) { debug('pull event: ' + inspect(event));