From dc2b7ceeac16d6ed6a0592ea2bf9e3daea1ad362 Mon Sep 17 00:00:00 2001 From: leepuppychow Date: Fri, 21 Sep 2018 13:58:19 -0600 Subject: [PATCH] Potential fix to let user choose which gpg path to use --- lib/gpg.js | 7 +++++++ lib/spawnGPG.js | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/gpg.js b/lib/gpg.js index 5d89f56..53f3b84 100644 --- a/lib/gpg.js +++ b/lib/gpg.js @@ -28,6 +28,13 @@ var GPG = { spawnGPG(stdin, args, fn); }, + /** + * Specify the path to gpg + */ + setPath: function(path) { + spawnGPG.setGpgPath(path) + }, + /** * Raw streaming call to gpg. Reads from input file and writes to output file. * diff --git a/lib/spawnGPG.js b/lib/spawnGPG.js index ef37c30..51316f6 100644 --- a/lib/spawnGPG.js +++ b/lib/spawnGPG.js @@ -109,9 +109,14 @@ module.exports.streaming = function(options, args, cb) { gpg.stdout.pipe(destStream); }; +var gpgPath = 'gpg'; +module.exports.setGpgPath = function(p) { + gpgPath = p; +}; + // Wrapper around spawn. Catches error events and passed global args. function spawnIt(args, fn) { - var gpg = spawn('gpg', globalArgs.concat(args || []) ); + var gpg = spawn(gpgPath, globalArgs.concat(args || []) ); gpg.on('error', fn); return gpg; }