mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Don't print env vars if Node's execFileSync fails
Just print the error message, to avoid printing sensitive information (like API access tokens).
This commit is contained in:
+3
-3
@@ -10,12 +10,12 @@ const os = require('os');
|
||||
const helpers = require('./helpers');
|
||||
|
||||
function getGitDescription() {
|
||||
const describe = String(childProcess.execFileSync('git', [
|
||||
const describe = String(helpers.safeExecFileSync('git', [
|
||||
'describe',
|
||||
'--tags',
|
||||
'--long',
|
||||
])).slice(0, -1);
|
||||
let branch = String(childProcess.execFileSync('git', [
|
||||
let branch = String(helpers.safeExecFileSync('git', [
|
||||
'rev-parse',
|
||||
'--abbrev-ref',
|
||||
'HEAD',
|
||||
@@ -66,7 +66,7 @@ function compress(sourcePath, destPath) {
|
||||
|
||||
// The last argument must have a leading dot for the subdirectory not to
|
||||
// be present in the archive, but path.join removes it, so it's prefixed.
|
||||
return childProcess.execFileSync(sevenzipPath, [
|
||||
return helpers.safeExecFileSync(sevenzipPath, [
|
||||
'a',
|
||||
'-r',
|
||||
filename,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const childProcess = require('child_process');
|
||||
const helpers = require('./helpers');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
@@ -15,7 +15,7 @@ sizes.forEach((size) => {
|
||||
const pngFile = path.join(buildDirectory, `icon-${size}.png`);
|
||||
convertArgs.push(pngFile);
|
||||
|
||||
childProcess.execFileSync('inkscape', [
|
||||
helpers.safeExecFileSync('inkscape', [
|
||||
'-z',
|
||||
'-e',
|
||||
pngFile,
|
||||
@@ -28,4 +28,4 @@ sizes.forEach((size) => {
|
||||
});
|
||||
|
||||
convertArgs.push(outputPath);
|
||||
childProcess.execFileSync('convert', convertArgs);
|
||||
helpers.safeExecFileSync('convert', convertArgs);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Helper functions shared across scripts.
|
||||
'use strict';
|
||||
const childProcess = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
@@ -87,7 +88,16 @@ function getMetadataValidatorBinaryPaths(rootPath) {
|
||||
return getBinaryPaths(rootPath, file);
|
||||
}
|
||||
|
||||
function safeExecFileSync(file, args, options) {
|
||||
try {
|
||||
childProcess.execFileSync(file, args, options);
|
||||
} catch (error) {
|
||||
throw new Error(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.fileExists = fileExists;
|
||||
module.exports.getAppReleasePaths = getAppReleasePaths;
|
||||
module.exports.getApiBinaryPaths = getApiBinaryPaths;
|
||||
module.exports.getMetadataValidatorBinaryPaths = getMetadataValidatorBinaryPaths;
|
||||
module.exports.safeExecFileSync = safeExecFileSync;
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ fs.readdirSync(l10nPath).forEach((file) => {
|
||||
|
||||
fs.accessSync(poPath, fs.R_OK);
|
||||
|
||||
childProcess.execFileSync('msgfmt', [
|
||||
helpers.safeExecFileSync('msgfmt', [
|
||||
poPath,
|
||||
'-o',
|
||||
moPath,
|
||||
|
||||
Reference in New Issue
Block a user