Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 508462e

Browse files
authored
fix open in shell command (#566)
1 parent f0e1af6 commit 508462e

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

modules/desktop/electron/libs/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { app } from "electron";
88
import log from "./logger";
99
import { MainWindowNotifier } from "./types";
1010

11+
// Be careful with globbing when passing this to a shell which might expand it. Either escape it or quote it.
1112
export const cliBinPath = path.join(getTeaPath(), "tea.xyz/v*/bin/tea");
1213

1314
export async function installPackage(
@@ -120,7 +121,7 @@ const notifyPackageInstalled = (rawPkg: string, notifyMainWindow: MainWindowNoti
120121
};
121122

122123
export async function openPackageEntrypointInTerminal(pkg: string) {
123-
let sh = `${cliBinPath} --sync --env=false +${pkg} `;
124+
let sh = `"${cliBinPath}" --sync --env=false +${pkg} `;
124125
switch (pkg) {
125126
case "github.com/AUTOMATIC1111/stable-diffusion-webui":
126127
sh += `~/.tea/${pkg}/v*/entrypoint.sh`;

modules/desktop/electron/libs/initialize.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import fs from "fs";
2-
import { getGuiPath, getTeaPath } from "./tea-dir";
3-
import log from "./logger";
4-
// import { cliBinPath, asyncExec } from "./cli";
2+
import { getTeaPath } from "./tea-dir";
53
import { createInitialSessionFile } from "./auth";
64
import * as https from "https";
75
import { spawn } from "child_process";
@@ -13,13 +11,11 @@ type InitState = "NOT_INITIALIZED" | "PENDING" | "INITIALIZED";
1311
class InitWatcher<T> {
1412
private initState: InitState;
1513
private initFunction: () => Promise<T>;
16-
private initialValue: T | undefined;
1714
private initializationPromise: Promise<T> | undefined;
1815

1916
constructor(initFunction: () => Promise<T>) {
2017
this.initState = "NOT_INITIALIZED";
2118
this.initFunction = initFunction;
22-
this.initialValue = undefined;
2319
this.initializationPromise = undefined;
2420
}
2521

@@ -28,7 +24,6 @@ class InitWatcher<T> {
2824
this.initState = "PENDING";
2925
this.initializationPromise = this.retryFunction(this.initFunction, 3)
3026
.then((value) => {
31-
this.initialValue = value;
3227
this.initState = "INITIALIZED";
3328
return value;
3429
})
@@ -69,6 +64,7 @@ class InitWatcher<T> {
6964
}
7065
}
7166

67+
// Be careful with globbing when passing this to a shell which might expand it. Either escape it or quote it.
7268
const teaCliPrefix = path.join(getTeaPath(), "tea.xyz/v*");
7369

7470
export const cliInitializationState = new InitWatcher<string>(async () => {

0 commit comments

Comments
 (0)