mirror of
https://github.com/ivabus/gui
synced 2025-06-08 00:00:27 +03:00
fix open in shell command (#566)
This commit is contained in:
parent
f0e1af6253
commit
508462e9cc
2 changed files with 4 additions and 7 deletions
|
@ -8,6 +8,7 @@ import { app } from "electron";
|
||||||
import log from "./logger";
|
import log from "./logger";
|
||||||
import { MainWindowNotifier } from "./types";
|
import { MainWindowNotifier } from "./types";
|
||||||
|
|
||||||
|
// Be careful with globbing when passing this to a shell which might expand it. Either escape it or quote it.
|
||||||
export const cliBinPath = path.join(getTeaPath(), "tea.xyz/v*/bin/tea");
|
export const cliBinPath = path.join(getTeaPath(), "tea.xyz/v*/bin/tea");
|
||||||
|
|
||||||
export async function installPackage(
|
export async function installPackage(
|
||||||
|
@ -120,7 +121,7 @@ const notifyPackageInstalled = (rawPkg: string, notifyMainWindow: MainWindowNoti
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function openPackageEntrypointInTerminal(pkg: string) {
|
export async function openPackageEntrypointInTerminal(pkg: string) {
|
||||||
let sh = `${cliBinPath} --sync --env=false +${pkg} `;
|
let sh = `"${cliBinPath}" --sync --env=false +${pkg} `;
|
||||||
switch (pkg) {
|
switch (pkg) {
|
||||||
case "github.com/AUTOMATIC1111/stable-diffusion-webui":
|
case "github.com/AUTOMATIC1111/stable-diffusion-webui":
|
||||||
sh += `~/.tea/${pkg}/v*/entrypoint.sh`;
|
sh += `~/.tea/${pkg}/v*/entrypoint.sh`;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { getGuiPath, getTeaPath } from "./tea-dir";
|
import { getTeaPath } from "./tea-dir";
|
||||||
import log from "./logger";
|
|
||||||
// import { cliBinPath, asyncExec } from "./cli";
|
|
||||||
import { createInitialSessionFile } from "./auth";
|
import { createInitialSessionFile } from "./auth";
|
||||||
import * as https from "https";
|
import * as https from "https";
|
||||||
import { spawn } from "child_process";
|
import { spawn } from "child_process";
|
||||||
|
@ -13,13 +11,11 @@ type InitState = "NOT_INITIALIZED" | "PENDING" | "INITIALIZED";
|
||||||
class InitWatcher<T> {
|
class InitWatcher<T> {
|
||||||
private initState: InitState;
|
private initState: InitState;
|
||||||
private initFunction: () => Promise<T>;
|
private initFunction: () => Promise<T>;
|
||||||
private initialValue: T | undefined;
|
|
||||||
private initializationPromise: Promise<T> | undefined;
|
private initializationPromise: Promise<T> | undefined;
|
||||||
|
|
||||||
constructor(initFunction: () => Promise<T>) {
|
constructor(initFunction: () => Promise<T>) {
|
||||||
this.initState = "NOT_INITIALIZED";
|
this.initState = "NOT_INITIALIZED";
|
||||||
this.initFunction = initFunction;
|
this.initFunction = initFunction;
|
||||||
this.initialValue = undefined;
|
|
||||||
this.initializationPromise = undefined;
|
this.initializationPromise = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +24,6 @@ class InitWatcher<T> {
|
||||||
this.initState = "PENDING";
|
this.initState = "PENDING";
|
||||||
this.initializationPromise = this.retryFunction(this.initFunction, 3)
|
this.initializationPromise = this.retryFunction(this.initFunction, 3)
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
this.initialValue = value;
|
|
||||||
this.initState = "INITIALIZED";
|
this.initState = "INITIALIZED";
|
||||||
return value;
|
return value;
|
||||||
})
|
})
|
||||||
|
@ -69,6 +64,7 @@ class InitWatcher<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Be careful with globbing when passing this to a shell which might expand it. Either escape it or quote it.
|
||||||
const teaCliPrefix = path.join(getTeaPath(), "tea.xyz/v*");
|
const teaCliPrefix = path.join(getTeaPath(), "tea.xyz/v*");
|
||||||
|
|
||||||
export const cliInitializationState = new InitWatcher<string>(async () => {
|
export const cliInitializationState = new InitWatcher<string>(async () => {
|
||||||
|
|
Loading…
Reference in a new issue