-
Notifications
You must be signed in to change notification settings - Fork 199
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
cash-global doesn't work in non-English operating systems #74
Comments
Okay thanks. Will check out! |
If you are under npm v6.x series or lower, the build command will be executed and you can install globally. install/preinstall.js'use strict';
var fs = require('fs');
var os = require('os');
var path = require('path');
var execSync = require('child_process').execSync;
var commands = require(__dirname + path.sep + '..' + path.sep + 'commands.json');
var mute = require('./mute');
var pth = '.' + path.sep + 'package.json';
var file = fs.readFileSync(pth, 'utf8');
var json = JSON.parse(file);
json.bin = json.bin || {};
// Shut the fuck up.
mute();
// These commands shouldn't be installed
// globally on Windows.
var exclusions = commands.globalExclusions;
var stdout = '';
for (var i = 0; i < commands.commands.length; ++i) {
var command = commands.commands[i];
var excluded = (exclusions.indexOf(command) > -1);
if (os.platform().indexOf('win') > -1 && !excluded) {
try {
execSync(`where ${command}`, {stdio: []});
stdout += 'Command exists: ' + command + '\n';
} catch (e) {
json.bin[command] = './bin/' + command + '.js';
stdout += 'Installed: ' + command + '\n';
}
}
}
// Write the updated json.
fs.writeFileSync(pth, JSON.stringify(json, null, ' '));
// Remove the muzzle and print my
// version of the stdout.
mute.unmute();
console.log(stdout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installing
cash-global
won't work properly in any OS whose language isn't English. That seems to be because of the test for the "Could not find" output of thewhere
command in thebin/preinstall.js
returning false positives in other languages.I couldn't find it in the original source code though but I certainly don't actually have a grasp of the projects bigger structure.
For example the failing output of
where
in my German Windows looks like thisI'd suggest using the npm
which
package instead since it's going to be included in the application anyways according to #71.The text was updated successfully, but these errors were encountered: