@@ -19,7 +19,6 @@ import { getLogger } from '../shared/logger'
1919import { AsyncCollection , toCollection } from '../shared/utilities/asyncCollection'
2020import { getCodeCatalystSpaceName , getCodeCatalystProjectName , getCodeCatalystDevEnvId } from '../shared/vscode/env'
2121import { sshAgentSocketVariable , startSshAgent , startVscodeRemote } from '../shared/extensions/ssh'
22- import { ChildProcess } from '../shared/utilities/processUtils'
2322import { isDevenvVscode } from './utils'
2423import { Timeout } from '../shared/utilities/timeoutUtils'
2524import { Commands } from '../shared/vscode/commands2'
@@ -28,7 +27,7 @@ import { fileExists } from '../shared/filesystemUtilities'
2827import { CodeCatalystAuthenticationProvider } from './auth'
2928import { ToolkitError } from '../shared/errors'
3029import { Result } from '../shared/utilities/result'
31- import { VscodeRemoteConnection , ensureDependencies } from '../shared/remoteSession'
30+ import { EnvProvider , VscodeRemoteConnection , createBoundProcess , ensureDependencies } from '../shared/remoteSession'
3231import { SshConfig , sshLogFileLocation } from '../shared/sshConfig'
3332import { fs } from '../shared'
3433
@@ -111,28 +110,6 @@ export function createCodeCatalystEnvProvider(
111110 }
112111}
113112
114- type EnvProvider = ( ) => Promise < NodeJS . ProcessEnv >
115-
116- /**
117- * Creates a new {@link ChildProcess} class bound to a specific dev environment. All instances of this
118- * derived class will have SSM session information injected as environment variables as-needed.
119- */
120- export function createBoundProcess ( envProvider : EnvProvider ) : typeof ChildProcess {
121- type Run = ChildProcess [ 'run' ]
122- return class SessionBoundProcess extends ChildProcess {
123- public override async run ( ...args : Parameters < Run > ) : ReturnType < Run > {
124- const options = args [ 0 ]
125- const envVars = await envProvider ( )
126- const spawnOptions = {
127- ...options ?. spawnOptions ,
128- env : { ...envVars , ...options ?. spawnOptions ?. env } ,
129- }
130-
131- return super . run ( { ...options , spawnOptions } )
132- }
133- }
134- }
135-
136113export async function cacheBearerToken ( bearerToken : string , devenvId : string ) : Promise < void > {
137114 await fs . writeFile ( bearerTokenCacheLocation ( devenvId ) , `${ bearerToken } ` , 'utf8' )
138115}
0 commit comments