Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Feb 5, 2018
1 parent 67c0863 commit 8b62779
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions test/util/path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ var path = require('../../util/path');

describe('Utility: `path`', function () {

// add platform binary to environment path
var envPath = process.env.path;
var macos = (process.platform == "darwin") ? require('macos-release').version : '';
var pathto7z = path.join(__dirname, "..","..","binaries", macos == '' ? process.platform : process.platform, macos );
if (envPath.indexOf('7za') < 0) {
process.env.path += (envPath[envPath.length -1] === ';') ? pathto7z : ';' + pathto7z;
}

it('should return deflaut flags with no args', function () {
var pathInSystem = exec('which 7za').toString();
});
Expand Down
16 changes: 11 additions & 5 deletions util/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@ var utilSwitches = require('./switches');
*/
module.exports = function (command, switches) {
return when.promise(function (fulfill, reject, progress) {

// add platform binary to environment path
var envPath = process.env.path;
var macos = (process.platform == "darwin") ? require('macos-release').version : '';
var pathto7z = path.join(__dirname, "..","binaries", macos == '' ? process.platform : process.platform, macos );
if (envPath.indexOf('7za') < 0) {
process.env.path += (envPath[envPath.length -1] === ';') ? pathto7z : ';' + pathto7z;
}

// Parse the command variable. If the command is not a string reject the
// Promise. Otherwise transform the command into two variables: the command
// name and the arguments.
if (typeof command !== 'string') {
return reject(new Error('Command must be a string'));
}
var macos = (process.platform == "darwin") ? require('macos-release').version : '';
var pathto7z = path.join(__dirname, "..","binaries", macos == '' ? process.platform : process.platform, macos );
}
// add platform binary to command
var cmd = path.join(pathto7z,command.split(' ')[0]);
var tmpcmd = command.split(' ')[0];
var cmd = path.join(pathto7z,tmpcmd);
var args = [ command.split(' ')[1] ];

// Parse and add command (non-switches parameters) to `args`.
Expand Down

0 comments on commit 8b62779

Please sign in to comment.