import { ChildProcess , SpawnOptions as ChildProcessSpawnOptions } from 'child_process' ; import { Observable } from 'rxjs' ; import { CancellationToken , Uri } from 'vscode' ; export const ICurrentProcess = Symbol ( 'ICurrentProcess' ) ; export interface ICurrentProcess { readonly env : NodeJS . ProcessEnv ; readonly argv : string [ ] ; readonly stdout : NodeJS . WriteStream ; readonly stdin : NodeJS . ReadStream ; on ( event , listener ) : this ; } export type ExecutionInfo = { execPath ? : string ; moduleName ? : string ; args : string [ ] ; } ; export const IBufferDecoder = Symbol ( 'IBufferDecoder' ) ; export interface IBufferDecoder { decode ( buffers , encoding ) : string ; } export type Output = { source : 'stdout' | 'stderr' ; out : string ; } ; export type ObservableExecutionResult = { proc : ChildProcess ; out : Observable < Output > ; } ; export type SpawnOptions = ChildProcessSpawnOptions & { encoding ? : string ; token ? : CancellationToken ; mergeStdOutErr ? : boolean ; throwOnStdErr ? : boolean ; } ; export type ExecutionResult = { stdout : string ; stderr ? : string ; } ; export interface IProcessService { execObservable ( file , args , options ? ) : ObservableExecutionResult ; exec ( file , args , options ? ) : Promise < ExecutionResult > ; } export const IProcessServiceFactory = Symbol ( 'IProcessServiceFactory' ) ; export interface IProcessServiceFactory { create ( resource ? ) : Promise < IProcessService > ; } export const IPythonExecutionFactory = Symbol ( 'IPythonExecutionFactory' ) ; export type ExecutionFactoryCreationOptions = { resource ? : Uri ; pythonPath ? : string ; } ; export interface IPythonExecutionFactory { create ( options ) : Promise < IPythonExecutionService > ; } export const IPythonExecutionService = Symbol ( 'IPythonExecutionService' ) ; export interface IPythonExecutionService { isModuleInstalled ( moduleName , env ? ) : Promise < boolean > ; exec ( args , options ) : Promise < ExecutionResult > ; execModule ( moduleName , args , options ) : Promise < ExecutionResult > ; } export const IModuleInstaller = Symbol ( 'IModuleInstaller' ) ; export interface IModuleInstaller { isInstalled ( moduleName , workspaceFolder , env ? ) : Promise < boolean > ; install ( moduleName , workspaceFolder , targetDirectory ? , customArgs ? ) : Promise < boolean > ; }