azure-pipelines-task-lib 3.2.0 → 4.0.0-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +74 -74
- package/Strings/resources.resjson/{de-de → de-DE}/resources.resjson +34 -34
- package/Strings/resources.resjson/{es-es → es-ES}/resources.resjson +34 -34
- package/Strings/resources.resjson/{fr-fr → fr-FR}/resources.resjson +34 -34
- package/Strings/resources.resjson/{ja-jp → ja-JP}/resources.resjson +34 -34
- package/ThirdPartyNotice.txt +1114 -1114
- package/internal.d.ts +130 -130
- package/internal.js +885 -885
- package/lib.json +37 -37
- package/mock-answer.d.ts +55 -55
- package/mock-answer.js +41 -41
- package/mock-run.d.ts +44 -44
- package/mock-run.js +92 -92
- package/mock-task.d.ts +111 -111
- package/mock-task.js +447 -438
- package/mock-test.d.ts +28 -28
- package/mock-test.js +298 -298
- package/mock-toolrunner.d.ts +41 -41
- package/mock-toolrunner.js +268 -268
- package/package.json +49 -49
- package/task.d.ts +718 -667
- package/task.js +2003 -1915
- package/taskcommand.d.ts +10 -10
- package/taskcommand.js +103 -103
- package/toolrunner.d.ts +159 -159
- package/toolrunner.js +967 -967
- package/vault.d.ts +10 -10
- package/vault.js +71 -71
package/taskcommand.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare class TaskCommand {
|
|
2
|
-
constructor(command: any, properties: any, message: any);
|
|
3
|
-
command: string;
|
|
4
|
-
message: string;
|
|
5
|
-
properties: {
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
};
|
|
8
|
-
toString(): string;
|
|
9
|
-
}
|
|
10
|
-
export declare function commandFromString(commandLine: any): TaskCommand;
|
|
1
|
+
export declare class TaskCommand {
|
|
2
|
+
constructor(command: any, properties: any, message: any);
|
|
3
|
+
command: string;
|
|
4
|
+
message: string;
|
|
5
|
+
properties: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
toString(): string;
|
|
9
|
+
}
|
|
10
|
+
export declare function commandFromString(commandLine: any): TaskCommand;
|
package/taskcommand.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.commandFromString = exports.TaskCommand = void 0;
|
|
4
|
-
//
|
|
5
|
-
// Command Format:
|
|
6
|
-
// ##vso[artifact.command key=value;key=value]user message
|
|
7
|
-
//
|
|
8
|
-
// Examples:
|
|
9
|
-
// ##vso[task.progress value=58]
|
|
10
|
-
// ##vso[task.issue type=warning;]This is the user warning message
|
|
11
|
-
//
|
|
12
|
-
var CMD_PREFIX = '##vso[';
|
|
13
|
-
var TaskCommand = /** @class */ (function () {
|
|
14
|
-
function TaskCommand(command, properties, message) {
|
|
15
|
-
if (!command) {
|
|
16
|
-
command = 'missing.command';
|
|
17
|
-
}
|
|
18
|
-
this.command = command;
|
|
19
|
-
this.properties = properties;
|
|
20
|
-
this.message = message;
|
|
21
|
-
}
|
|
22
|
-
TaskCommand.prototype.toString = function () {
|
|
23
|
-
var cmdStr = CMD_PREFIX + this.command;
|
|
24
|
-
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
25
|
-
cmdStr += ' ';
|
|
26
|
-
for (var key in this.properties) {
|
|
27
|
-
if (this.properties.hasOwnProperty(key)) {
|
|
28
|
-
var val = this.properties[key];
|
|
29
|
-
if (val) {
|
|
30
|
-
// safely append the val - avoid blowing up when attempting to
|
|
31
|
-
// call .replace() if message is not a string for some reason
|
|
32
|
-
cmdStr += key + '=' + escape('' + (val || '')) + ';';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
cmdStr += ']';
|
|
38
|
-
// safely append the message - avoid blowing up when attempting to
|
|
39
|
-
// call .replace() if message is not a string for some reason
|
|
40
|
-
var message = '' + (this.message || '');
|
|
41
|
-
cmdStr += escapedata(message);
|
|
42
|
-
return cmdStr;
|
|
43
|
-
};
|
|
44
|
-
return TaskCommand;
|
|
45
|
-
}());
|
|
46
|
-
exports.TaskCommand = TaskCommand;
|
|
47
|
-
function commandFromString(commandLine) {
|
|
48
|
-
var preLen = CMD_PREFIX.length;
|
|
49
|
-
var lbPos = commandLine.indexOf('[');
|
|
50
|
-
var rbPos = commandLine.indexOf(']');
|
|
51
|
-
if (lbPos == -1 || rbPos == -1 || rbPos - lbPos < 3) {
|
|
52
|
-
throw new Error('Invalid command brackets');
|
|
53
|
-
}
|
|
54
|
-
var cmdInfo = commandLine.substring(lbPos + 1, rbPos);
|
|
55
|
-
var spaceIdx = cmdInfo.indexOf(' ');
|
|
56
|
-
var command = cmdInfo;
|
|
57
|
-
var properties = {};
|
|
58
|
-
if (spaceIdx > 0) {
|
|
59
|
-
command = cmdInfo.trim().substring(0, spaceIdx);
|
|
60
|
-
var propSection = cmdInfo.trim().substring(spaceIdx + 1);
|
|
61
|
-
var propLines = propSection.split(';');
|
|
62
|
-
propLines.forEach(function (propLine) {
|
|
63
|
-
propLine = propLine.trim();
|
|
64
|
-
if (propLine.length > 0) {
|
|
65
|
-
var eqIndex = propLine.indexOf('=');
|
|
66
|
-
if (eqIndex == -1) {
|
|
67
|
-
throw new Error('Invalid property: ' + propLine);
|
|
68
|
-
}
|
|
69
|
-
var key = propLine.substring(0, eqIndex);
|
|
70
|
-
var val = propLine.substring(eqIndex + 1);
|
|
71
|
-
properties[key] = unescape(val);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
var msg = unescapedata(commandLine.substring(rbPos + 1));
|
|
76
|
-
var cmd = new TaskCommand(command, properties, msg);
|
|
77
|
-
return cmd;
|
|
78
|
-
}
|
|
79
|
-
exports.commandFromString = commandFromString;
|
|
80
|
-
function escapedata(s) {
|
|
81
|
-
return s.replace(/%/g, '%AZP25')
|
|
82
|
-
.replace(/\r/g, '%0D')
|
|
83
|
-
.replace(/\n/g, '%0A');
|
|
84
|
-
}
|
|
85
|
-
function unescapedata(s) {
|
|
86
|
-
return s.replace(/%0D/g, '\r')
|
|
87
|
-
.replace(/%0A/g, '\n')
|
|
88
|
-
.replace(/%AZP25/g, '%');
|
|
89
|
-
}
|
|
90
|
-
function escape(s) {
|
|
91
|
-
return s.replace(/%/g, '%AZP25')
|
|
92
|
-
.replace(/\r/g, '%0D')
|
|
93
|
-
.replace(/\n/g, '%0A')
|
|
94
|
-
.replace(/]/g, '%5D')
|
|
95
|
-
.replace(/;/g, '%3B');
|
|
96
|
-
}
|
|
97
|
-
function unescape(s) {
|
|
98
|
-
return s.replace(/%0D/g, '\r')
|
|
99
|
-
.replace(/%0A/g, '\n')
|
|
100
|
-
.replace(/%5D/g, ']')
|
|
101
|
-
.replace(/%3B/g, ';')
|
|
102
|
-
.replace(/%AZP25/g, '%');
|
|
103
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandFromString = exports.TaskCommand = void 0;
|
|
4
|
+
//
|
|
5
|
+
// Command Format:
|
|
6
|
+
// ##vso[artifact.command key=value;key=value]user message
|
|
7
|
+
//
|
|
8
|
+
// Examples:
|
|
9
|
+
// ##vso[task.progress value=58]
|
|
10
|
+
// ##vso[task.issue type=warning;]This is the user warning message
|
|
11
|
+
//
|
|
12
|
+
var CMD_PREFIX = '##vso[';
|
|
13
|
+
var TaskCommand = /** @class */ (function () {
|
|
14
|
+
function TaskCommand(command, properties, message) {
|
|
15
|
+
if (!command) {
|
|
16
|
+
command = 'missing.command';
|
|
17
|
+
}
|
|
18
|
+
this.command = command;
|
|
19
|
+
this.properties = properties;
|
|
20
|
+
this.message = message;
|
|
21
|
+
}
|
|
22
|
+
TaskCommand.prototype.toString = function () {
|
|
23
|
+
var cmdStr = CMD_PREFIX + this.command;
|
|
24
|
+
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
25
|
+
cmdStr += ' ';
|
|
26
|
+
for (var key in this.properties) {
|
|
27
|
+
if (this.properties.hasOwnProperty(key)) {
|
|
28
|
+
var val = this.properties[key];
|
|
29
|
+
if (val) {
|
|
30
|
+
// safely append the val - avoid blowing up when attempting to
|
|
31
|
+
// call .replace() if message is not a string for some reason
|
|
32
|
+
cmdStr += key + '=' + escape('' + (val || '')) + ';';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
cmdStr += ']';
|
|
38
|
+
// safely append the message - avoid blowing up when attempting to
|
|
39
|
+
// call .replace() if message is not a string for some reason
|
|
40
|
+
var message = '' + (this.message || '');
|
|
41
|
+
cmdStr += escapedata(message);
|
|
42
|
+
return cmdStr;
|
|
43
|
+
};
|
|
44
|
+
return TaskCommand;
|
|
45
|
+
}());
|
|
46
|
+
exports.TaskCommand = TaskCommand;
|
|
47
|
+
function commandFromString(commandLine) {
|
|
48
|
+
var preLen = CMD_PREFIX.length;
|
|
49
|
+
var lbPos = commandLine.indexOf('[');
|
|
50
|
+
var rbPos = commandLine.indexOf(']');
|
|
51
|
+
if (lbPos == -1 || rbPos == -1 || rbPos - lbPos < 3) {
|
|
52
|
+
throw new Error('Invalid command brackets');
|
|
53
|
+
}
|
|
54
|
+
var cmdInfo = commandLine.substring(lbPos + 1, rbPos);
|
|
55
|
+
var spaceIdx = cmdInfo.indexOf(' ');
|
|
56
|
+
var command = cmdInfo;
|
|
57
|
+
var properties = {};
|
|
58
|
+
if (spaceIdx > 0) {
|
|
59
|
+
command = cmdInfo.trim().substring(0, spaceIdx);
|
|
60
|
+
var propSection = cmdInfo.trim().substring(spaceIdx + 1);
|
|
61
|
+
var propLines = propSection.split(';');
|
|
62
|
+
propLines.forEach(function (propLine) {
|
|
63
|
+
propLine = propLine.trim();
|
|
64
|
+
if (propLine.length > 0) {
|
|
65
|
+
var eqIndex = propLine.indexOf('=');
|
|
66
|
+
if (eqIndex == -1) {
|
|
67
|
+
throw new Error('Invalid property: ' + propLine);
|
|
68
|
+
}
|
|
69
|
+
var key = propLine.substring(0, eqIndex);
|
|
70
|
+
var val = propLine.substring(eqIndex + 1);
|
|
71
|
+
properties[key] = unescape(val);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
var msg = unescapedata(commandLine.substring(rbPos + 1));
|
|
76
|
+
var cmd = new TaskCommand(command, properties, msg);
|
|
77
|
+
return cmd;
|
|
78
|
+
}
|
|
79
|
+
exports.commandFromString = commandFromString;
|
|
80
|
+
function escapedata(s) {
|
|
81
|
+
return s.replace(/%/g, '%AZP25')
|
|
82
|
+
.replace(/\r/g, '%0D')
|
|
83
|
+
.replace(/\n/g, '%0A');
|
|
84
|
+
}
|
|
85
|
+
function unescapedata(s) {
|
|
86
|
+
return s.replace(/%0D/g, '\r')
|
|
87
|
+
.replace(/%0A/g, '\n')
|
|
88
|
+
.replace(/%AZP25/g, '%');
|
|
89
|
+
}
|
|
90
|
+
function escape(s) {
|
|
91
|
+
return s.replace(/%/g, '%AZP25')
|
|
92
|
+
.replace(/\r/g, '%0D')
|
|
93
|
+
.replace(/\n/g, '%0A')
|
|
94
|
+
.replace(/]/g, '%5D')
|
|
95
|
+
.replace(/;/g, '%3B');
|
|
96
|
+
}
|
|
97
|
+
function unescape(s) {
|
|
98
|
+
return s.replace(/%0D/g, '\r')
|
|
99
|
+
.replace(/%0A/g, '\n')
|
|
100
|
+
.replace(/%5D/g, ']')
|
|
101
|
+
.replace(/%3B/g, ';')
|
|
102
|
+
.replace(/%AZP25/g, '%');
|
|
103
|
+
}
|
package/toolrunner.d.ts
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Q = require('q');
|
|
3
|
-
import events = require('events');
|
|
4
|
-
/**
|
|
5
|
-
* Interface for exec options
|
|
6
|
-
*/
|
|
7
|
-
export interface IExecOptions extends IExecSyncOptions {
|
|
8
|
-
/** optional. whether to fail if output to stderr. defaults to false */
|
|
9
|
-
failOnStdErr?: boolean;
|
|
10
|
-
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
|
11
|
-
ignoreReturnCode?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Interface for execSync options
|
|
15
|
-
*/
|
|
16
|
-
export interface IExecSyncOptions {
|
|
17
|
-
/** optional working directory. defaults to current */
|
|
18
|
-
cwd?: string;
|
|
19
|
-
/** optional envvar dictionary. defaults to current process's env */
|
|
20
|
-
env?: {
|
|
21
|
-
[key: string]: string | undefined;
|
|
22
|
-
};
|
|
23
|
-
/** optional. defaults to false */
|
|
24
|
-
silent?: boolean;
|
|
25
|
-
/** Optional. Default is process.stdout. */
|
|
26
|
-
outStream?: NodeJS.WritableStream;
|
|
27
|
-
/** Optional. Default is process.stderr. */
|
|
28
|
-
errStream?: NodeJS.WritableStream;
|
|
29
|
-
/** optional. Whether to skip quoting/escaping arguments if needed. defaults to false. */
|
|
30
|
-
windowsVerbatimArguments?: boolean;
|
|
31
|
-
/** optional. Run command inside of the shell. Defaults to false. */
|
|
32
|
-
shell?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Interface for exec results returned from synchronous exec functions
|
|
36
|
-
*/
|
|
37
|
-
export interface IExecSyncResult {
|
|
38
|
-
/** standard output */
|
|
39
|
-
stdout: string;
|
|
40
|
-
/** error output */
|
|
41
|
-
stderr: string;
|
|
42
|
-
/** return code */
|
|
43
|
-
code: number;
|
|
44
|
-
/** Error on failure */
|
|
45
|
-
error: Error;
|
|
46
|
-
}
|
|
47
|
-
export declare class ToolRunner extends events.EventEmitter {
|
|
48
|
-
constructor(toolPath: string);
|
|
49
|
-
private readonly cmdSpecialChars;
|
|
50
|
-
private toolPath;
|
|
51
|
-
private args;
|
|
52
|
-
private pipeOutputToTool;
|
|
53
|
-
private pipeOutputToFile;
|
|
54
|
-
private childProcess;
|
|
55
|
-
private _debug;
|
|
56
|
-
private _argStringToArray;
|
|
57
|
-
private _getCommandString;
|
|
58
|
-
private _processLineBuffer;
|
|
59
|
-
/**
|
|
60
|
-
* Wraps an arg string with specified char if it's not already wrapped
|
|
61
|
-
* @returns {string} Arg wrapped with specified char
|
|
62
|
-
* @param {string} arg Input argument string
|
|
63
|
-
* @param {string} wrapChar A char input string should be wrapped with
|
|
64
|
-
*/
|
|
65
|
-
private _wrapArg;
|
|
66
|
-
/**
|
|
67
|
-
* Unwraps an arg string wrapped with specified char
|
|
68
|
-
* @param arg Arg wrapped with specified char
|
|
69
|
-
* @param wrapChar A char to be removed
|
|
70
|
-
*/
|
|
71
|
-
private _unwrapArg;
|
|
72
|
-
/**
|
|
73
|
-
* Determine if arg string is wrapped with specified char
|
|
74
|
-
* @param arg Input arg string
|
|
75
|
-
*/
|
|
76
|
-
private _isWrapped;
|
|
77
|
-
private _getSpawnFileName;
|
|
78
|
-
private _getSpawnArgs;
|
|
79
|
-
/**
|
|
80
|
-
* Escape specified character.
|
|
81
|
-
* @param arg String to escape char in
|
|
82
|
-
* @param charToEscape Char should be escaped
|
|
83
|
-
*/
|
|
84
|
-
private _escapeChar;
|
|
85
|
-
private _isCmdFile;
|
|
86
|
-
/**
|
|
87
|
-
* Determine whether the cmd arg needs to be quoted. Returns true if arg contains any of special chars array.
|
|
88
|
-
* @param arg The cmd command arg.
|
|
89
|
-
* @param additionalChars Additional chars which should be also checked.
|
|
90
|
-
*/
|
|
91
|
-
private _needQuotesForCmd;
|
|
92
|
-
private _windowsQuoteCmdArg;
|
|
93
|
-
private _uv_quote_cmd_arg;
|
|
94
|
-
private _cloneExecOptions;
|
|
95
|
-
private _getSpawnOptions;
|
|
96
|
-
private _getSpawnSyncOptions;
|
|
97
|
-
private execWithPiping;
|
|
98
|
-
/**
|
|
99
|
-
* Add argument
|
|
100
|
-
* Append an argument or an array of arguments
|
|
101
|
-
* returns ToolRunner for chaining
|
|
102
|
-
*
|
|
103
|
-
* @param val string cmdline or array of strings
|
|
104
|
-
* @returns ToolRunner
|
|
105
|
-
*/
|
|
106
|
-
arg(val: string | string[]): ToolRunner;
|
|
107
|
-
/**
|
|
108
|
-
* Parses an argument line into one or more arguments
|
|
109
|
-
* e.g. .line('"arg one" two -z') is equivalent to .arg(['arg one', 'two', '-z'])
|
|
110
|
-
* returns ToolRunner for chaining
|
|
111
|
-
*
|
|
112
|
-
* @param val string argument line
|
|
113
|
-
* @returns ToolRunner
|
|
114
|
-
*/
|
|
115
|
-
line(val: string): ToolRunner;
|
|
116
|
-
/**
|
|
117
|
-
* Add argument(s) if a condition is met
|
|
118
|
-
* Wraps arg(). See arg for details
|
|
119
|
-
* returns ToolRunner for chaining
|
|
120
|
-
*
|
|
121
|
-
* @param condition boolean condition
|
|
122
|
-
* @param val string cmdline or array of strings
|
|
123
|
-
* @returns ToolRunner
|
|
124
|
-
*/
|
|
125
|
-
argIf(condition: any, val: any): this;
|
|
126
|
-
/**
|
|
127
|
-
* Pipe output of exec() to another tool
|
|
128
|
-
* @param tool
|
|
129
|
-
* @param file optional filename to additionally stream the output to.
|
|
130
|
-
* @returns {ToolRunner}
|
|
131
|
-
*/
|
|
132
|
-
pipeExecOutputToTool(tool: ToolRunner, file?: string): ToolRunner;
|
|
133
|
-
/**
|
|
134
|
-
* Exec a tool.
|
|
135
|
-
* Output will be streamed to the live console.
|
|
136
|
-
* Returns promise with return code
|
|
137
|
-
*
|
|
138
|
-
* @param tool path to tool to exec
|
|
139
|
-
* @param options optional exec options. See IExecOptions
|
|
140
|
-
* @returns number
|
|
141
|
-
*/
|
|
142
|
-
exec(options?: IExecOptions): Q.Promise<number>;
|
|
143
|
-
/**
|
|
144
|
-
* Exec a tool synchronously.
|
|
145
|
-
* Output will be *not* be streamed to the live console. It will be returned after execution is complete.
|
|
146
|
-
* Appropriate for short running tools
|
|
147
|
-
* Returns IExecSyncResult with output and return code
|
|
148
|
-
*
|
|
149
|
-
* @param tool path to tool to exec
|
|
150
|
-
* @param options optional exec options. See IExecSyncOptions
|
|
151
|
-
* @returns IExecSyncResult
|
|
152
|
-
*/
|
|
153
|
-
execSync(options?: IExecSyncOptions): IExecSyncResult;
|
|
154
|
-
/**
|
|
155
|
-
* Used to close child process by sending SIGNINT signal.
|
|
156
|
-
* It allows executed script to have some additional logic on SIGINT, before exiting.
|
|
157
|
-
*/
|
|
158
|
-
killChildProcess(): void;
|
|
159
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Q = require('q');
|
|
3
|
+
import events = require('events');
|
|
4
|
+
/**
|
|
5
|
+
* Interface for exec options
|
|
6
|
+
*/
|
|
7
|
+
export interface IExecOptions extends IExecSyncOptions {
|
|
8
|
+
/** optional. whether to fail if output to stderr. defaults to false */
|
|
9
|
+
failOnStdErr?: boolean;
|
|
10
|
+
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
|
11
|
+
ignoreReturnCode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Interface for execSync options
|
|
15
|
+
*/
|
|
16
|
+
export interface IExecSyncOptions {
|
|
17
|
+
/** optional working directory. defaults to current */
|
|
18
|
+
cwd?: string;
|
|
19
|
+
/** optional envvar dictionary. defaults to current process's env */
|
|
20
|
+
env?: {
|
|
21
|
+
[key: string]: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
/** optional. defaults to false */
|
|
24
|
+
silent?: boolean;
|
|
25
|
+
/** Optional. Default is process.stdout. */
|
|
26
|
+
outStream?: NodeJS.WritableStream;
|
|
27
|
+
/** Optional. Default is process.stderr. */
|
|
28
|
+
errStream?: NodeJS.WritableStream;
|
|
29
|
+
/** optional. Whether to skip quoting/escaping arguments if needed. defaults to false. */
|
|
30
|
+
windowsVerbatimArguments?: boolean;
|
|
31
|
+
/** optional. Run command inside of the shell. Defaults to false. */
|
|
32
|
+
shell?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Interface for exec results returned from synchronous exec functions
|
|
36
|
+
*/
|
|
37
|
+
export interface IExecSyncResult {
|
|
38
|
+
/** standard output */
|
|
39
|
+
stdout: string;
|
|
40
|
+
/** error output */
|
|
41
|
+
stderr: string;
|
|
42
|
+
/** return code */
|
|
43
|
+
code: number;
|
|
44
|
+
/** Error on failure */
|
|
45
|
+
error: Error;
|
|
46
|
+
}
|
|
47
|
+
export declare class ToolRunner extends events.EventEmitter {
|
|
48
|
+
constructor(toolPath: string);
|
|
49
|
+
private readonly cmdSpecialChars;
|
|
50
|
+
private toolPath;
|
|
51
|
+
private args;
|
|
52
|
+
private pipeOutputToTool;
|
|
53
|
+
private pipeOutputToFile;
|
|
54
|
+
private childProcess;
|
|
55
|
+
private _debug;
|
|
56
|
+
private _argStringToArray;
|
|
57
|
+
private _getCommandString;
|
|
58
|
+
private _processLineBuffer;
|
|
59
|
+
/**
|
|
60
|
+
* Wraps an arg string with specified char if it's not already wrapped
|
|
61
|
+
* @returns {string} Arg wrapped with specified char
|
|
62
|
+
* @param {string} arg Input argument string
|
|
63
|
+
* @param {string} wrapChar A char input string should be wrapped with
|
|
64
|
+
*/
|
|
65
|
+
private _wrapArg;
|
|
66
|
+
/**
|
|
67
|
+
* Unwraps an arg string wrapped with specified char
|
|
68
|
+
* @param arg Arg wrapped with specified char
|
|
69
|
+
* @param wrapChar A char to be removed
|
|
70
|
+
*/
|
|
71
|
+
private _unwrapArg;
|
|
72
|
+
/**
|
|
73
|
+
* Determine if arg string is wrapped with specified char
|
|
74
|
+
* @param arg Input arg string
|
|
75
|
+
*/
|
|
76
|
+
private _isWrapped;
|
|
77
|
+
private _getSpawnFileName;
|
|
78
|
+
private _getSpawnArgs;
|
|
79
|
+
/**
|
|
80
|
+
* Escape specified character.
|
|
81
|
+
* @param arg String to escape char in
|
|
82
|
+
* @param charToEscape Char should be escaped
|
|
83
|
+
*/
|
|
84
|
+
private _escapeChar;
|
|
85
|
+
private _isCmdFile;
|
|
86
|
+
/**
|
|
87
|
+
* Determine whether the cmd arg needs to be quoted. Returns true if arg contains any of special chars array.
|
|
88
|
+
* @param arg The cmd command arg.
|
|
89
|
+
* @param additionalChars Additional chars which should be also checked.
|
|
90
|
+
*/
|
|
91
|
+
private _needQuotesForCmd;
|
|
92
|
+
private _windowsQuoteCmdArg;
|
|
93
|
+
private _uv_quote_cmd_arg;
|
|
94
|
+
private _cloneExecOptions;
|
|
95
|
+
private _getSpawnOptions;
|
|
96
|
+
private _getSpawnSyncOptions;
|
|
97
|
+
private execWithPiping;
|
|
98
|
+
/**
|
|
99
|
+
* Add argument
|
|
100
|
+
* Append an argument or an array of arguments
|
|
101
|
+
* returns ToolRunner for chaining
|
|
102
|
+
*
|
|
103
|
+
* @param val string cmdline or array of strings
|
|
104
|
+
* @returns ToolRunner
|
|
105
|
+
*/
|
|
106
|
+
arg(val: string | string[]): ToolRunner;
|
|
107
|
+
/**
|
|
108
|
+
* Parses an argument line into one or more arguments
|
|
109
|
+
* e.g. .line('"arg one" two -z') is equivalent to .arg(['arg one', 'two', '-z'])
|
|
110
|
+
* returns ToolRunner for chaining
|
|
111
|
+
*
|
|
112
|
+
* @param val string argument line
|
|
113
|
+
* @returns ToolRunner
|
|
114
|
+
*/
|
|
115
|
+
line(val: string): ToolRunner;
|
|
116
|
+
/**
|
|
117
|
+
* Add argument(s) if a condition is met
|
|
118
|
+
* Wraps arg(). See arg for details
|
|
119
|
+
* returns ToolRunner for chaining
|
|
120
|
+
*
|
|
121
|
+
* @param condition boolean condition
|
|
122
|
+
* @param val string cmdline or array of strings
|
|
123
|
+
* @returns ToolRunner
|
|
124
|
+
*/
|
|
125
|
+
argIf(condition: any, val: any): this;
|
|
126
|
+
/**
|
|
127
|
+
* Pipe output of exec() to another tool
|
|
128
|
+
* @param tool
|
|
129
|
+
* @param file optional filename to additionally stream the output to.
|
|
130
|
+
* @returns {ToolRunner}
|
|
131
|
+
*/
|
|
132
|
+
pipeExecOutputToTool(tool: ToolRunner, file?: string): ToolRunner;
|
|
133
|
+
/**
|
|
134
|
+
* Exec a tool.
|
|
135
|
+
* Output will be streamed to the live console.
|
|
136
|
+
* Returns promise with return code
|
|
137
|
+
*
|
|
138
|
+
* @param tool path to tool to exec
|
|
139
|
+
* @param options optional exec options. See IExecOptions
|
|
140
|
+
* @returns number
|
|
141
|
+
*/
|
|
142
|
+
exec(options?: IExecOptions): Q.Promise<number>;
|
|
143
|
+
/**
|
|
144
|
+
* Exec a tool synchronously.
|
|
145
|
+
* Output will be *not* be streamed to the live console. It will be returned after execution is complete.
|
|
146
|
+
* Appropriate for short running tools
|
|
147
|
+
* Returns IExecSyncResult with output and return code
|
|
148
|
+
*
|
|
149
|
+
* @param tool path to tool to exec
|
|
150
|
+
* @param options optional exec options. See IExecSyncOptions
|
|
151
|
+
* @returns IExecSyncResult
|
|
152
|
+
*/
|
|
153
|
+
execSync(options?: IExecSyncOptions): IExecSyncResult;
|
|
154
|
+
/**
|
|
155
|
+
* Used to close child process by sending SIGNINT signal.
|
|
156
|
+
* It allows executed script to have some additional logic on SIGINT, before exiting.
|
|
157
|
+
*/
|
|
158
|
+
killChildProcess(): void;
|
|
159
|
+
}
|