From 635cd6219680910a4ff1b6c5aa4b4adaf74b781b Mon Sep 17 00:00:00 2001 From: Jared Allard Date: Sun, 24 Jan 2016 21:08:38 -0800 Subject: [PATCH] exe: handle tar extraction & download failures better --- lib/bundle.js | 2 -- lib/exe.js | 12 ++++++++++++ lib/log.js | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/bundle.js b/lib/bundle.js index bc96522..25a40d6 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -44,8 +44,6 @@ function bundle (input, nc, complete) { var ws = fs.createWriteStream(bundlePath); var proc = spawn('node', [path.join(__dirname, '../', 'node_modules/browserify/bin/cmd.js'), '--node', input ]); - // TODO: Get path of nexe directory, and refer to it. - proc.stdout.pipe(ws); proc.on('error', function(err) { diff --git a/lib/exe.js b/lib/exe.js index e527030..80d1a10 100644 --- a/lib/exe.js +++ b/lib/exe.js @@ -359,6 +359,11 @@ function _downloadNode(version, directory, nodeConfigureArgs, nodeMakeArgs, comp tar.stderr.pipe(process.stderr); tar.on("close", function () { next(); }) + tar.on("error", function (err) { + console.log(err); + _log("error", "failed to extract the node tar file."); + process.exit(1); + }); } }, @@ -701,6 +706,12 @@ function _logProgress (req) { }); }); + req.on("error", function(err) { + console.log(err); + _log("error", "failed to download node sources,"); + process.exit(1); + }); + return req; } @@ -711,6 +722,7 @@ function _logProgress (req) { * @param {object} options - fallback options * * @todo implement options overriding package defaults. + * @todo make this much less hackily implemented.... * * @return {object} nexe.compile options object **/ diff --git a/lib/log.js b/lib/log.js index d06a2e0..75f445f 100644 --- a/lib/log.js +++ b/lib/log.js @@ -1,5 +1,6 @@ /** * Copyright (c) 2013 Craig Condon + * Copyright (c) 2015-2016 Jared Allard * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the