From 94595ecd9ff2e8a817a18d871cb29f6e7d949358 Mon Sep 17 00:00:00 2001 From: Daniel Teleginski Camargo Date: Thu, 30 Mar 2023 11:28:37 -0600 Subject: [PATCH] feat: propagate process environment variables This will allow the spwawn process to consume environment variables defined by the nodejs process. Allowing us to change the behaviour of the next call by updating a particular environment variable (ie. using a different configuration folder by updating the MAGICK_CONFIGURE_PATH) --- lib/command.js | 2 +- lib/compare.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/command.js b/lib/command.js index 46930cd..805d1d7 100644 --- a/lib/command.js +++ b/lib/command.js @@ -238,7 +238,7 @@ module.exports = function (proto) { return cb(new Error("imageMagick does not support minify, use -scale or -sample. Alternatively, use graphicsMagick")); } try { - proc = spawn(bin, args); + proc = spawn(bin, args, {env: process.env}); } catch (e) { return cb(e); } diff --git a/lib/compare.js b/lib/compare.js index 7ba3397..b5ed6e5 100644 --- a/lib/compare.js +++ b/lib/compare.js @@ -96,7 +96,7 @@ module.exports = exports = function (proto) { var cmd = bin + ' ' + args.map(utils.escape).join(' ') debug(cmd); - var proc = spawn(bin, args); + var proc = spawn(bin, args, {env: process.env}); var stdout = ''; var stderr = ''; proc.stdout.on('data',function(data) { stdout+=data });