mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(windows): launch npm-installed native session CLIs (#122334)
* fix(windows): resolve runnable npm launchers * fix(windows): preserve npm shim argv in terminal sessions
This commit is contained in:
committed by
GitHub
parent
c37023ff96
commit
a5420dfd91
+21
-13
@@ -21,19 +21,27 @@ export function resolveNodeHostExecutable(
|
||||
},
|
||||
): { executable: string; pathEnv?: string } | undefined {
|
||||
const env = options.env ?? process.env;
|
||||
if (options.strategy === "direct") {
|
||||
const resolved = resolveExecutableFromPathEnv(
|
||||
executable,
|
||||
options.pathEnv ?? env.PATH ?? env.Path ?? "",
|
||||
const resolve = (includeExtensionless: boolean) => {
|
||||
if (options.strategy === "direct") {
|
||||
const resolved = resolveExecutableFromPathEnv(
|
||||
executable,
|
||||
options.pathEnv ?? env.PATH ?? env.Path ?? "",
|
||||
env,
|
||||
{ includeExtensionless },
|
||||
);
|
||||
return resolved ? { executable: resolved } : undefined;
|
||||
}
|
||||
return resolveExecutableFromUserShellPathInternal(executable, {
|
||||
env,
|
||||
{ includeExtensionless: options.includeExtensionless },
|
||||
);
|
||||
return resolved ? { executable: resolved } : undefined;
|
||||
pathEnv: options.pathEnv,
|
||||
includeExtensionless,
|
||||
strategy: options.strategy,
|
||||
});
|
||||
};
|
||||
if (options.includeExtensionless !== undefined || process.platform !== "win32") {
|
||||
return resolve(options.includeExtensionless ?? true);
|
||||
}
|
||||
return resolveExecutableFromUserShellPathInternal(executable, {
|
||||
env,
|
||||
pathEnv: options.pathEnv,
|
||||
includeExtensionless: options.includeExtensionless,
|
||||
strategy: options.strategy,
|
||||
});
|
||||
// npm installs a non-runnable bare shim beside its .cmd launcher. Search every
|
||||
// PATH source for PATHEXT launchers before retaining bare-only native hosts.
|
||||
return resolve(false) ?? resolve(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user