|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { ITerminal, IPtyOpenOptions, IPtyForkOptions, IWindowsPtyForkOptions } from './interfaces'; |
|
|
import { ArgvOrCommandLine } from './types'; |
|
|
|
|
|
let terminalCtor: any; |
|
|
if (process.platform === 'win32') { |
|
|
terminalCtor = require('./windowsTerminal').WindowsTerminal; |
|
|
} else { |
|
|
terminalCtor = require('./unixTerminal').UnixTerminal; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function spawn(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { |
|
|
return new terminalCtor(file, args, opt); |
|
|
} |
|
|
|
|
|
|
|
|
export function fork(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { |
|
|
return new terminalCtor(file, args, opt); |
|
|
} |
|
|
|
|
|
|
|
|
export function createTerminal(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { |
|
|
return new terminalCtor(file, args, opt); |
|
|
} |
|
|
|
|
|
export function open(options: IPtyOpenOptions): ITerminal { |
|
|
return terminalCtor.open(options); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const native = (process.platform !== 'win32' ? require('../build/Release/pty.node') : null); |
|
|
|