From 27bd574406fe67c57181e62afff1eb1eb282abea Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 12 Jul 2019 12:24:12 -0400 Subject: [PATCH] fix(@embark/ipfs): fix ipfs upload with wrong error message --- packages/embark-ipfs/src/upload.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/embark-ipfs/src/upload.js b/packages/embark-ipfs/src/upload.js index a21f73342..ceb6330f5 100644 --- a/packages/embark-ipfs/src/upload.js +++ b/packages/embark-ipfs/src/upload.js @@ -34,7 +34,11 @@ class IPFS { console.debug(cmd); shelljs.exec(cmd, {silent:true}, function(code, stdout, stderr){ // {silent:true}: don't echo cmd output so it can be controlled via logLevel console.log(stdout.green); - callback(stderr, stdout); + if (code) { + // stderr can sometimes be an error or the total uploaded size + return callback(stderr || __('IPFS exited with code %s', code.toString())); + } + callback(null, stdout); }); }, function getHashFromOutput(result, callback) { @@ -78,8 +82,7 @@ class IPFS { } ], function (err, dir_hash) { if (err) { - console.log(__("error uploading to ipfs").red); - console.log(err); + console.error(__("error uploading to ipfs").red); cb(err); } else cb(null, dir_hash);