mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-28 01:28:51 +00:00
b0dce6b477
Change-type: patch
65 lines
2.5 KiB
Diff
65 lines
2.5 KiB
Diff
diff --git a/node_modules/qqjs/node_modules/execa/index.js b/node_modules/qqjs/node_modules/execa/index.js
|
|
index 06f3969..8bca191 100644
|
|
--- a/node_modules/qqjs/node_modules/execa/index.js
|
|
+++ b/node_modules/qqjs/node_modules/execa/index.js
|
|
@@ -14,6 +14,17 @@ const stdio = require('./lib/stdio');
|
|
|
|
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
|
|
|
+// OSTYPE is 'msys' for MSYS 1.0 and for MSYS2, or 'cygwin' for Cygwin
|
|
+// but note that OSTYPE is not "exported" by default, so run: export OSTYPE=$OSTYPE
|
|
+// MSYSTEM is 'MINGW32' for MSYS 1.0, 'MSYS' for MSYS2, and undefined for Cygwin
|
|
+const isCygwin = process.env.OSTYPE === 'cygwin';
|
|
+const isMinGW = process.env.MSYSTEM && process.env.MSYSTEM.startsWith('MINGW');
|
|
+const isMSYS2 = process.env.MSYSTEM && process.env.MSYSTEM.startsWith('MSYS');
|
|
+
|
|
+console.log(`[patched execa] detected "${
|
|
+ isCygwin ? 'Cygwin' : isMinGW ? 'MinGW' : isMSYS2 ? 'MSYS2' : 'standard'
|
|
+}" environment (MSYSTEM="${process.env.MSYSTEM}")`);
|
|
+
|
|
function handleArgs(cmd, args, opts) {
|
|
let parsed;
|
|
|
|
@@ -104,13 +115,22 @@ function handleShell(fn, cmd, opts) {
|
|
|
|
opts = Object.assign({}, opts);
|
|
|
|
- if (process.platform === 'win32') {
|
|
+ if (isMSYS2 || isMinGW || isCygwin) {
|
|
+ file = process.env.MSYSSHELLPATH ||
|
|
+ (isMSYS2 ? 'C:\\msys64\\usr\\bin\\bash.exe' :
|
|
+ (isMinGW ? 'C:\\MinGW\\msys\\1.0\\bin\\bash.exe' :
|
|
+ (isCygwin ? 'C:\\cygwin64\\bin\\bash.exe' : file)));
|
|
+ }
|
|
+ else if (process.platform === 'win32') {
|
|
opts.__winShell = true;
|
|
file = process.env.comspec || 'cmd.exe';
|
|
args = ['/s', '/c', `"${cmd}"`];
|
|
opts.windowsVerbatimArguments = true;
|
|
}
|
|
|
|
+ const argStr = (args && args.length) ? `["${args.join('", "')}"]` : args;
|
|
+ console.log(`[patched execa] handleShell file="${file}" args=${argStr}`);
|
|
+
|
|
if (opts.shell) {
|
|
file = opts.shell;
|
|
delete opts.shell;
|
|
@@ -199,6 +219,9 @@ module.exports = (cmd, args, opts) => {
|
|
const maxBuffer = parsed.opts.maxBuffer;
|
|
const joinedCmd = joinCmd(cmd, args);
|
|
|
|
+ const argStr = (args && args.length) ? `["${args.join('", "')}"]` : args;
|
|
+ console.log(`[patched execa] parsed.cmd="${parsed.cmd}" parsed.args=${argStr}`);
|
|
+
|
|
let spawned;
|
|
try {
|
|
spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts);
|
|
@@ -364,3 +387,7 @@ module.exports.sync = (cmd, args, opts) => {
|
|
module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd, opts);
|
|
|
|
module.exports.spawn = util.deprecate(module.exports, 'execa.spawn() is deprecated. Use execa() instead.');
|
|
+
|
|
+module.exports.isCygwin = isCygwin;
|
|
+module.exports.isMinGW = isMinGW;
|
|
+module.exports.isMSYS2 = isMSYS2;
|