If the network connection is lost (e.g. cable pulled), the node process will exit because of an error even that has no handler registered.
Need some fix like:
diff --git a/node_modules/gcloud/lib/storage/file.js b/node_modules/gcloud/lib/storage/file.js
index 8e1a26e..4aaec72 100644
--- a/node_modules/gcloud/lib/storage/file.js
+++ b/node_modules/gcloud/lib/storage/file.js
@@ -913,11 +915,20 @@
var writeStream = request(reqOpts);
writeStream.callback = util.noop;
-
+ var errorHandled = false;
+ writeStream.on('error', function(err) {
+ if (!errorHandled) {
+ errorHandled = true;
+ handleError(err);
+ }
+ });
writeStream.on('complete', function(res) {
util.handleResp(null, res, res.body, function(err, data) {
if (err) {
- handleError(err);
+ if (!errorHandled) {
+ errorHandled = true;
+ handleError(err);
+ }
return;
}
If the network connection is lost (e.g. cable pulled), the node process will exit because of an error even that has no handler registered.
Need some fix like: