Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential fix to let user choose which gpg path to use (fixes issue #26) #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/gpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
7 changes: 6 additions & 1 deletion lib/spawnGPG.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down