diff --git a/src/index.ts b/src/index.ts index fc66672b4..53d0322e5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,9 +4,7 @@ * Copyright (c) 2018, Microsoft Corporation (MIT License). */ -import * as path from 'path'; -import { Terminal as BaseTerminal } from './terminal'; -import { ITerminal, IPtyOpenOptions, IPtyForkOptions } from './interfaces'; +import { ITerminal, IPtyOpenOptions, IPtyForkOptions, IWindowsPtyForkOptions } from './interfaces'; import { ArgvOrCommandLine } from './types'; let terminalCtor: any; @@ -28,17 +26,17 @@ if (process.platform === 'win32') { * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx */ -export function spawn(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions): ITerminal { +export function spawn(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { return new terminalCtor(file, args, opt); } /** @deprecated */ -export function fork(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions): ITerminal { +export function fork(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { return new terminalCtor(file, args, opt); } /** @deprecated */ -export function createTerminal(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions): ITerminal { +export function createTerminal(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { return new terminalCtor(file, args, opt); } diff --git a/src/interfaces.ts b/src/interfaces.ts index 144f7393d..163bc6ded 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -112,11 +112,24 @@ export interface IPtyForkOptions { cols?: number; rows?: number; cwd?: string; - env?: IProcessEnv; + env?: { [key: string]: string }; uid?: number; gid?: number; encoding?: string; - experimentalUseConpty?: boolean | undefined; + handleFlowControl?: boolean; + flowControlPause?: string; + flowControlResume?: string; +} + +export interface IWindowsPtyForkOptions { + name?: string; + cols?: number; + rows?: number; + cwd?: string; + env?: { [key: string]: string }; + encoding?: string; + experimentalUseConpty?: boolean; + conptyInheritCursor?: boolean; handleFlowControl?: boolean; flowControlPause?: string; flowControlResume?: string; diff --git a/src/utils.ts b/src/utils.ts index b028843ed..6306c8ba2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,8 +3,6 @@ * Copyright (c) 2018, Microsoft Corporation (MIT License). */ -import * as path from 'path'; - export function assign(target: any, ...sources: any[]): any { sources.forEach(source => Object.keys(source).forEach(key => target[key] = source[key])); return target; diff --git a/src/windowsPtyAgent.test.ts b/src/windowsPtyAgent.test.ts index af2893336..dc2104b34 100644 --- a/src/windowsPtyAgent.test.ts +++ b/src/windowsPtyAgent.test.ts @@ -3,7 +3,7 @@ * Copyright (c) 2018, Microsoft Corporation (MIT License). */ - import * as assert from 'assert'; +import * as assert from 'assert'; import { argsToCommandLine } from './windowsPtyAgent'; function check(file: string, args: string | string[], expected: string): void { diff --git a/src/windowsTerminal.ts b/src/windowsTerminal.ts index 239dbf1a4..5cc3d64ed 100644 --- a/src/windowsTerminal.ts +++ b/src/windowsTerminal.ts @@ -7,10 +7,9 @@ import { Socket } from 'net'; import { Terminal, DEFAULT_COLS, DEFAULT_ROWS } from './terminal'; import { WindowsPtyAgent } from './windowsPtyAgent'; -import { IPtyForkOptions, IPtyOpenOptions } from './interfaces'; +import { IPtyOpenOptions, IWindowsPtyForkOptions } from './interfaces'; import { ArgvOrCommandLine } from './types'; import { assign } from './utils'; -import { IWindowsPtyForkOptions } from 'node-pty'; const DEFAULT_FILE = 'cmd.exe'; const DEFAULT_NAME = 'Windows Shell';