UNPKG

1.88 kBJavaScriptView Raw
1"use strict";
2/**
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).
6 */
7Object.defineProperty(exports, "__esModule", { value: true });
8var terminalCtor;
9if (process.platform === 'win32') {
10 terminalCtor = require('./windowsTerminal').WindowsTerminal;
11}
12else {
13 terminalCtor = require('./unixTerminal').UnixTerminal;
14}
15/**
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
26 */
27function spawn(file, args, opt) {
28 return new terminalCtor(file, args, opt);
29}
30exports.spawn = spawn;
31/** @deprecated */
32function fork(file, args, opt) {
33 return new terminalCtor(file, args, opt);
34}
35exports.fork = fork;
36/** @deprecated */
37function createTerminal(file, args, opt) {
38 return new terminalCtor(file, args, opt);
39}
40exports.createTerminal = createTerminal;
41function open(options) {
42 return terminalCtor.open(options);
43}
44exports.open = open;
45/**
46 * Expose the native API when not Windows, note that this is not public API and
47 * could be removed at any time.
48 */
49exports.native = (process.platform !== 'win32' ? require('../build/Release/pty.node') : null);
50//# sourceMappingURL=index.js.map
\No newline at end of file