mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(crabbox): bootstrap absolute macOS env pnpm
This commit is contained in:
@@ -932,6 +932,7 @@ function stripShellExecutionPrefixes(wordsInput, options = {}) {
|
||||
function stripEnvCommandOptions(words, { canShimIgnoreEnvironment = true } = {}) {
|
||||
const originalWords = [...words];
|
||||
const envCommand = words.shift() ?? "";
|
||||
const canShimThisEnv = canShimIgnoreEnvironment && isSupportedSystemEnvCommand(envCommand);
|
||||
let ignoresEnvironment = false;
|
||||
for (;;) {
|
||||
const word = words[0] ?? "";
|
||||
@@ -976,7 +977,7 @@ function stripEnvCommandOptions(words, { canShimIgnoreEnvironment = true } = {})
|
||||
return words.length > 0;
|
||||
}
|
||||
if (word === "-i" || word === "--ignore-environment") {
|
||||
if (!canShimIgnoreEnvironment || envCommand.includes("/")) {
|
||||
if (!canShimThisEnv) {
|
||||
words.splice(0, words.length, ...originalWords);
|
||||
return false;
|
||||
}
|
||||
@@ -997,7 +998,7 @@ function stripEnvCommandOptions(words, { canShimIgnoreEnvironment = true } = {})
|
||||
}
|
||||
if (word.startsWith("-") && word !== "-") {
|
||||
if (word.includes("i")) {
|
||||
if (!canShimIgnoreEnvironment || envCommand.includes("/")) {
|
||||
if (!canShimThisEnv) {
|
||||
words.splice(0, words.length, ...originalWords);
|
||||
return false;
|
||||
}
|
||||
@@ -1006,7 +1007,7 @@ function stripEnvCommandOptions(words, { canShimIgnoreEnvironment = true } = {})
|
||||
words.shift();
|
||||
continue;
|
||||
}
|
||||
if (ignoresEnvironment && (!canShimIgnoreEnvironment || envCommand.includes("/"))) {
|
||||
if (ignoresEnvironment && !canShimThisEnv) {
|
||||
words.splice(0, words.length, ...originalWords);
|
||||
return false;
|
||||
}
|
||||
@@ -1014,6 +1015,10 @@ function stripEnvCommandOptions(words, { canShimIgnoreEnvironment = true } = {})
|
||||
}
|
||||
}
|
||||
|
||||
function isSupportedSystemEnvCommand(command) {
|
||||
return command === "env" || command === "/usr/bin/env";
|
||||
}
|
||||
|
||||
function shellWordBasename(word) {
|
||||
return (word ?? "").split("/").pop() ?? "";
|
||||
}
|
||||
@@ -1738,11 +1743,7 @@ function remoteAwsMacosJsBootstrap({ packageManager = false } = {}) {
|
||||
}
|
||||
|
||||
function scopedAwsMacosEnvCommand(commandArgs) {
|
||||
if (
|
||||
commandArgs.length <= 1 ||
|
||||
shellWordBasename(commandArgs[0]) !== "env" ||
|
||||
commandArgs[0].includes("/")
|
||||
) {
|
||||
if (commandArgs.length <= 1 || !isSupportedSystemEnvCommand(commandArgs[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user