11import 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" ;
53import { createInitialSessionFile } from "./auth" ;
64import * as https from "https" ;
75import { spawn } from "child_process" ;
@@ -13,13 +11,11 @@ type InitState = "NOT_INITIALIZED" | "PENDING" | "INITIALIZED";
1311class 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.
7268const teaCliPrefix = path . join ( getTeaPath ( ) , "tea.xyz/v*" ) ;
7369
7470export const cliInitializationState = new InitWatcher < string > ( async ( ) => {
0 commit comments