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; }