3 * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
4 * Copyright (c) 2016, Daniel Imms (MIT License).
5 * Copyright (c) 2018, Microsoft Corporation (MIT License).
7 Object.defineProperty(exports, "__esModule", { value: true });
9 if (process.platform === 'win32') {
10 terminalCtor = require('./windowsTerminal').WindowsTerminal;
13 terminalCtor = require('./unixTerminal').UnixTerminal;
16 * Forks a process as a pseudoterminal.
17 * @param file The file to launch.
18 * @param args The file's arguments as argv (string[]) or in a pre-escaped
19 * CommandLine format (string). Note that the CommandLine option is only
20 * available on Windows and is expected to be escaped properly.
21 * @param options The options of the terminal.
22 * @throws When the file passed to spawn with does not exists.
23 * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
24 * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
25 * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
27 function spawn(file, args, opt) {
28 return new terminalCtor(file, args, opt);
30 exports.spawn = spawn;
32 function fork(file, args, opt) {
33 return new terminalCtor(file, args, opt);
37 function createTerminal(file, args, opt) {
38 return new terminalCtor(file, args, opt);
40 exports.createTerminal = createTerminal;
41 function open(options) {
42 return terminalCtor.open(options);
46 * Expose the native API when not Windows, note that this is not public API and
47 * could be removed at any time.
49 exports.native = (process.platform !== 'win32' ? require('../build/Release/pty.node') : null);
50 //# sourceMappingURL=index.js.map