azure-pipelines-task-lib 4.17.0 → 4.17.1

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/toolrunner.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
2
4
  import Q = require('q');
3
5
  import events = require('events');
4
6
  /**
package/toolrunner.js CHANGED
@@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () {
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -107,7 +109,7 @@ var ToolRunner = /** @class */ (function (_super) {
107
109
  }
108
110
  // Windows + verbatim
109
111
  else if (options.windowsVerbatimArguments) {
110
- commandParts.push("\"" + toolPath + "\"");
112
+ commandParts.push("\"".concat(toolPath, "\""));
111
113
  commandParts = commandParts.concat(args);
112
114
  }
113
115
  else if (options.shell) {
@@ -160,7 +162,7 @@ var ToolRunner = /** @class */ (function (_super) {
160
162
  */
161
163
  ToolRunner.prototype._wrapArg = function (arg, wrapChar) {
162
164
  if (!this._isWrapped(arg, wrapChar)) {
163
- return "" + wrapChar + arg + wrapChar;
165
+ return "".concat(wrapChar).concat(arg).concat(wrapChar);
164
166
  }
165
167
  return arg;
166
168
  };
@@ -171,7 +173,7 @@ var ToolRunner = /** @class */ (function (_super) {
171
173
  */
172
174
  ToolRunner.prototype._unwrapArg = function (arg, wrapChar) {
173
175
  if (this._isWrapped(arg, wrapChar)) {
174
- var pattern = new RegExp("(^\\\\?" + wrapChar + ")|(\\\\?" + wrapChar + "$)", 'g');
176
+ var pattern = new RegExp("(^\\\\?".concat(wrapChar, ")|(\\\\?").concat(wrapChar, "$)"), 'g');
175
177
  return arg.trim().replace(pattern, '');
176
178
  }
177
179
  return arg;
@@ -181,7 +183,7 @@ var ToolRunner = /** @class */ (function (_super) {
181
183
  * @param arg Input arg string
182
184
  */
183
185
  ToolRunner.prototype._isWrapped = function (arg, wrapChar) {
184
- var pattern = new RegExp("^\\\\?" + wrapChar + ".+\\\\?" + wrapChar + "$");
186
+ var pattern = new RegExp("^\\\\?".concat(wrapChar, ".+\\\\?").concat(wrapChar, "$"));
185
187
  return pattern.test(arg.trim());
186
188
  };
187
189
  ToolRunner.prototype._getSpawnFileName = function (options) {
@@ -199,7 +201,7 @@ var ToolRunner = /** @class */ (function (_super) {
199
201
  var _this = this;
200
202
  if (process.platform == 'win32') {
201
203
  if (this._isCmdFile()) {
202
- var argline = "/D /S /C \"" + this._windowsQuoteCmdArg(this.toolPath);
204
+ var argline = "/D /S /C \"".concat(this._windowsQuoteCmdArg(this.toolPath));
203
205
  for (var i = 0; i < this.args.length; i++) {
204
206
  argline += ' ';
205
207
  argline += options.windowsVerbatimArguments ? this.args[i] : this._windowsQuoteCmdArg(this.args[i]);
@@ -243,7 +245,7 @@ var ToolRunner = /** @class */ (function (_super) {
243
245
  if (arguments.length != 1) {
244
246
  throw new Error('Unexpected arguments passed to args.unshift when windowsVerbatimArguments flag is set.');
245
247
  }
246
- return Array.prototype.unshift.call(args_1, "\"" + arguments[0] + "\""); // quote the file name
248
+ return Array.prototype.unshift.call(args_1, "\"".concat(arguments[0], "\"")); // quote the file name
247
249
  };
248
250
  return args_1;
249
251
  }
@@ -447,7 +449,7 @@ var ToolRunner = /** @class */ (function (_super) {
447
449
  if (arg.indexOf('"') < 0 && arg.indexOf('\\') < 0) {
448
450
  // No embedded double quotes or backslashes, so I can just wrap
449
451
  // quote marks around the whole thing.
450
- return "\"" + arg + "\"";
452
+ return "\"".concat(arg, "\"");
451
453
  }
452
454
  // Expected input/output:
453
455
  // input : hello"world
@@ -564,7 +566,7 @@ var ToolRunner = /** @class */ (function (_super) {
564
566
  });
565
567
  fileStream.on('error', function (err) {
566
568
  waitingEvents--; //there were errors writing to the file, write is done
567
- _this._debug("Failed to pipe output of " + toolPathFirst + " to file " + _this.pipeOutputToFile + ". Error = " + err);
569
+ _this._debug("Failed to pipe output of ".concat(toolPathFirst, " to file ").concat(_this.pipeOutputToFile, ". Error = ").concat(err));
568
570
  fileStream = null;
569
571
  if (waitingEvents == 0) {
570
572
  if (error) {
@@ -744,7 +746,7 @@ var ToolRunner = /** @class */ (function (_super) {
744
746
  });
745
747
  fileStream.on('error', function (err) {
746
748
  waitingEvents--; //there were errors writing to the file, write is done
747
- _this._debug("Failed to pipe output of " + toolPathFirst + " to file " + _this.pipeOutputToFile + ". Error = " + err);
749
+ _this._debug("Failed to pipe output of ".concat(toolPathFirst, " to file ").concat(_this.pipeOutputToFile, ". Error = ").concat(err));
748
750
  fileStream = null;
749
751
  if (waitingEvents == 0) {
750
752
  if (error) {
@@ -1037,17 +1039,18 @@ var ToolRunner = /** @class */ (function (_super) {
1037
1039
  state.processClosed = true;
1038
1040
  state.CheckComplete();
1039
1041
  });
1042
+ // Do not write debug logs here. Sometimes stdio not closed yet and you can damage user output commands.
1040
1043
  cp.on('exit', function (code, signal) {
1041
1044
  state.processExitCode = code;
1045
+ state.processExitSignal = signal;
1042
1046
  state.processExited = true;
1043
- _this._debug("STDIO streams have closed and received exit code " + code + " and signal " + signal + " for tool '" + _this.toolPath + "'");
1044
1047
  state.CheckComplete();
1045
1048
  });
1046
1049
  cp.on('close', function (code, signal) {
1047
- state.processExitCode = code;
1048
- state.processExited = true;
1050
+ state.processCloseCode = code;
1051
+ state.processCloseSignal = signal;
1049
1052
  state.processClosed = true;
1050
- _this._debug("STDIO streams have closed and received exit code " + code + " and signal " + signal + " for tool '" + _this.toolPath + "'");
1053
+ state.processExited = true;
1051
1054
  state.CheckComplete();
1052
1055
  });
1053
1056
  return new Promise(emitDoneEvent);
@@ -1148,17 +1151,18 @@ var ToolRunner = /** @class */ (function (_super) {
1148
1151
  state.processClosed = true;
1149
1152
  state.CheckComplete();
1150
1153
  });
1154
+ // Do not write debug logs here. Sometimes stdio not closed yet and you can damage user output commands.
1151
1155
  cp.on('exit', function (code, signal) {
1152
1156
  state.processExitCode = code;
1157
+ state.processExitSignal = signal;
1153
1158
  state.processExited = true;
1154
- _this._debug("STDIO streams have closed and received exit code " + code + " and signal " + signal + " for tool '" + _this.toolPath + "'");
1155
1159
  state.CheckComplete();
1156
1160
  });
1157
1161
  cp.on('close', function (code, signal) {
1158
- state.processExitCode = code;
1159
- state.processExited = true;
1162
+ state.processCloseCode = code;
1163
+ state.processCloseSignal = signal;
1160
1164
  state.processClosed = true;
1161
- _this._debug("STDIO streams have closed and received exit code " + code + " and signal " + signal + " for tool '" + _this.toolPath + "'");
1165
+ state.processExited = true;
1162
1166
  state.CheckComplete();
1163
1167
  });
1164
1168
  return defer.promise;
@@ -1204,7 +1208,7 @@ var ToolRunner = /** @class */ (function (_super) {
1204
1208
  ToolRunner.prototype.killChildProcess = function (signal) {
1205
1209
  if (signal === void 0) { signal = "SIGTERM"; }
1206
1210
  if (this.childProcess) {
1207
- this._debug("[killChildProcess] Signal " + signal + " received");
1211
+ this._debug("[killChildProcess] Signal ".concat(signal, " received"));
1208
1212
  this.childProcess.kill(signal);
1209
1213
  }
1210
1214
  };
@@ -1246,6 +1250,7 @@ var ExecState = /** @class */ (function (_super) {
1246
1250
  // determine whether there is an error
1247
1251
  var error;
1248
1252
  if (this.processExited) {
1253
+ this._debug("Process exited with code ".concat(this.processExitCode, " and signal ").concat(this.processExitSignal, " for tool '").concat(this.toolPath, "'"));
1249
1254
  if (this.processError) {
1250
1255
  error = new Error(im._loc('LIB_ProcessError', this.toolPath, this.processError));
1251
1256
  }
@@ -1256,6 +1261,9 @@ var ExecState = /** @class */ (function (_super) {
1256
1261
  error = new Error(im._loc('LIB_ProcessStderr', this.toolPath));
1257
1262
  }
1258
1263
  }
1264
+ if (this.processClosed) {
1265
+ this._debug("STDIO streams have closed and received exit code ".concat(this.processCloseCode, " and signal ").concat(this.processCloseSignal, " for tool '").concat(this.toolPath, "'"));
1266
+ }
1259
1267
  // clear the timeout
1260
1268
  if (this.timeout) {
1261
1269
  clearTimeout(this.timeout);