From bd5fd1867997f70180d8da6b57807a993c880ca8 Mon Sep 17 00:00:00 2001 From: Pedro Dias Date: Wed, 5 Feb 2020 02:56:21 +0000 Subject: [PATCH] Debug https://github.com/apocas/dockerode/issues/538 --- lib/docker.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/docker.js b/lib/docker.js index dfaad04..e1cffbf 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -251,7 +251,7 @@ Docker.prototype.checkAuth = function(opts, callback) { Docker.prototype.buildImage = function(file, opts, callback) { var self = this; var content; - var pack; + var pack = tar.pack(); if (!callback && typeof opts === 'function') { callback = opts; @@ -304,26 +304,7 @@ Docker.prototype.buildImage = function(file, opts, callback) { pack = tar.pack(file.context, { entries: file.src }); - - if (callback === undefined) { - return new self.modem.Promise(function(resolve, reject) { - pack.on('error', function(error) { - return reject(error); - }); - pack.on('end', function() { - return resolve(build(stream)); - }); - var stream = pack.pipe(zlib.createGzip()); - }); - } else { - pack.on('error', function(error) { - return callback(error); - }); - pack.on('end', function() { - return build(stream); - }); - var stream = pack.pipe(zlib.createGzip()); - } + return build(pack.pipe(zlib.createGzip())); } else { return build(file); }