git extension: expose exec/spawn

This commit is contained in:
Joao Moreno
2018-08-22 12:31:46 +02:00
parent 1341461209
commit 8983d89550
2 changed files with 28 additions and 1 deletions

View File

@@ -3,15 +3,32 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Uri, SourceControlInputBox, Event } from 'vscode';
import { Uri, SourceControlInputBox, Event, CancellationToken } from 'vscode';
import * as cp from 'child_process';
declare module GitExtension {
export interface IExecResult<T extends string | Buffer> {
readonly exitCode: number;
readonly stdout: T;
readonly stderr: string;
}
export interface SpawnOptions extends cp.SpawnOptions {
readonly input?: string;
readonly encoding?: string;
readonly log?: boolean;
readonly cancellationToken?: CancellationToken;
}
export interface API {
readonly gitPath: string;
readonly repositories: Repository[];
readonly onDidOpenRepository: Event<Repository>;
readonly onDidCloseRepository: Event<Repository>;
exec(cwd: string, args: string[], options?: SpawnOptions): Promise<IExecResult<string>>;
spawn(cwd: string, args: string[], options?: SpawnOptions): cp.ChildProcess;
}
export interface InputBox {