mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 10:50:58 +00:00
refactor: share plugin setup helpers
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { isWSL, isWSLEnv } from "../infra/wsl.js";
|
||||
import { isRemoteEnvironment } from "../infra/remote-env.js";
|
||||
import { isWSL } from "../infra/wsl.js";
|
||||
import { runCommandWithTimeout } from "../process/exec.js";
|
||||
import { detectBinary } from "./setup-binary.js";
|
||||
|
||||
export { isRemoteEnvironment } from "../infra/remote-env.js";
|
||||
|
||||
function shouldSkipBrowserOpenInTests(): boolean {
|
||||
if (process.env.VITEST) {
|
||||
return true;
|
||||
@@ -61,27 +64,6 @@ async function resolveBrowserOpenCommand(): Promise<BrowserOpenCommand> {
|
||||
return { argv: null };
|
||||
}
|
||||
|
||||
export function isRemoteEnvironment(): boolean {
|
||||
if (process.env.SSH_CLIENT || process.env.SSH_TTY || process.env.SSH_CONNECTION) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.env.REMOTE_CONTAINERS || process.env.CODESPACES) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
process.platform === "linux" &&
|
||||
!process.env.DISPLAY &&
|
||||
!process.env.WAYLAND_DISPLAY &&
|
||||
!isWSLEnv()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function openUrl(url: string): Promise<boolean> {
|
||||
if (shouldSkipBrowserOpenInTests()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user