zarro 1.199.0 → 1.199.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/gulp-tasks/default-report-generator.js +1 -1
- package/gulp-tasks/git-submodules.js +1 -1
- package/gulp-tasks/modules/dotnet-cli.js +20 -1222
- package/gulp-tasks/modules/exec.js +2 -3
- package/gulp-tasks/modules/find-local-nuget.js +1 -1
- package/gulp-tasks/modules/gulp-dotnet-cli.js +37 -6
- package/gulp-tasks/modules/gulp-dotnetcover.js +1 -1
- package/gulp-tasks/modules/gulp-nuget-restore.js +1 -1
- package/gulp-tasks/modules/gulp-xbuild.js +1 -1
- package/gulp-tasks/modules/nuget-cli.js +4 -3
- package/gulp-tasks/modules/nuget-push.js +1 -1
- package/gulp-tasks/modules/nuget-update-self.js +4 -4
- package/gulp-tasks/modules/open.js +2 -2
- package/gulp-tasks/modules/resolve-nuget-api-key.js +1 -1
- package/gulp-tasks/modules/spawn-nuget.js +1 -1
- package/gulp-tasks/modules/spawn.js +1 -265
- package/gulp-tasks/modules/streamify.js +2 -22
- package/gulp-tasks/modules/system.js +3 -243
- package/gulp-tasks/modules/test-dotnet-logic.js +2 -2
- package/gulp-tasks/modules/test-zarro.js +1 -1
- package/gulp-tasks/modules/verify-exe.js +1 -1
- package/gulp-tasks/nuget-push.js +1 -1
- package/gulp-tasks/release-npm.js +3 -3
- package/gulp-tasks/release-nuget.js +1 -1
- package/gulp-tasks/start/gulpfile.js +6 -6
- package/gulp-tasks/start-dev-smtp-server.js +2 -2
- package/gulp-tasks/update-self.js +2 -2
- package/gulp-tasks/upgrade-packages.js +1 -1
- package/index-modules/handlers/create-task.js +1 -1
- package/package.json +5 -4
- package/tsconfig.json +2 -1
- package/types.d.ts +71 -276
|
@@ -10,10 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
13
|
(function () {
|
|
15
14
|
// this is a convenient wrapper around system()
|
|
16
|
-
const { fileExists, folderExists } = require("yafs"), path = require("path"), quoteIfRequired = requireModule("quote-if-required"), failAfter = requireModule("fail-after"), isWindows = requireModule("is-windows"), system =
|
|
15
|
+
const { fileExists, folderExists } = require("yafs"), path = require("path"), quoteIfRequired = requireModule("quote-if-required"), failAfter = requireModule("fail-after"), isWindows = requireModule("is-windows"), system = require("system-wrapper"), debug = requireModule("debug")(__filename), which = requireModule("which"), ZarroError = requireModule("zarro-error");
|
|
17
16
|
function makeDefaultOptions() {
|
|
18
17
|
return {
|
|
19
18
|
cwd: process.cwd(),
|
|
@@ -81,7 +80,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
81
80
|
const stderrHandler = (_a = handlers === null || handlers === void 0 ? void 0 : handlers.stderr) !== null && _a !== void 0 ? _a : noop;
|
|
82
81
|
const stdoutHandler = (_b = handlers === null || handlers === void 0 ? void 0 : handlers.stdout) !== null && _b !== void 0 ? _b : noop;
|
|
83
82
|
try {
|
|
84
|
-
await system(cmd, args, Object.assign(Object.assign({}, opts), { stdout: (s) => {
|
|
83
|
+
await system.system(cmd, args, Object.assign(Object.assign({}, opts), { stdout: (s) => {
|
|
85
84
|
result.push(s);
|
|
86
85
|
stdout.push(s);
|
|
87
86
|
originalStdOut(s);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const path = require("path"), log = requireModule("log"), { fileExists
|
|
3
|
+
const path = require("path"), log = requireModule("log"), { fileExists } = require("yafs"), resolveNuget = requireModule("resolve-nuget"), shimNuget = requireModule("shim-nuget"), pathUnquote = requireModule("path-unquote"), downloadNuget = requireModule("download-nuget"), env = requireModule("env");
|
|
4
4
|
let startedDownload = false, resolver = (_) => {
|
|
5
5
|
}, lastResolution = new Promise(function (resolve) {
|
|
6
6
|
resolver = resolve;
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const dotnetCli = __importStar(require("dotnet-cli"));
|
|
2
27
|
(function () {
|
|
3
|
-
const dotnetCli = requireModule("dotnet-cli");
|
|
4
28
|
const { streamify } = requireModule("streamify");
|
|
5
29
|
const ZarroError = requireModule("zarro-error");
|
|
6
30
|
const { log, colors } = requireModule("gulp-util");
|
|
7
31
|
const { yellowBright, cyanBright } = colors;
|
|
32
|
+
const env = requireModule("env");
|
|
8
33
|
function wrap(fn) {
|
|
9
34
|
return async (opts) => {
|
|
10
35
|
const result = await fn(opts);
|
|
@@ -54,7 +79,7 @@
|
|
|
54
79
|
const copy = Object.assign({}, opts);
|
|
55
80
|
copy.target = f.path;
|
|
56
81
|
if (copy.publishContainer) {
|
|
57
|
-
const containerOpts = await dotnetCli.resolveContainerOptions(copy), nameOpt = definitelyFind(containerOpts,
|
|
82
|
+
const containerOpts = await dotnetCli.resolveContainerOptions(copy), nameOpt = definitelyFind(containerOpts, "containerImageName"), tagOpt = definitelyFind(containerOpts, "containerImageTag"), registryOpt = definitelyFind(containerOpts, "containerRegistry");
|
|
58
83
|
logResolvedOption("Publish container", nameOpt);
|
|
59
84
|
logResolvedOption(" with tag", tagOpt);
|
|
60
85
|
logResolvedOption(" to registry", registryOpt);
|
|
@@ -62,15 +87,21 @@
|
|
|
62
87
|
return copy;
|
|
63
88
|
}, "gulp-dotnet-cli-publish", "publishing dotnet project");
|
|
64
89
|
}
|
|
90
|
+
const envVarLookup = {
|
|
91
|
+
"containerImageName": env.DOTNET_PUBLISH_CONTAINER_IMAGE_NAME,
|
|
92
|
+
"containerImageTag": env.DOTNET_PUBLISH_CONTAINER_IMAGE_TAG,
|
|
93
|
+
"containerRegistry": env.DOTNET_PUBLISH_CONTAINER_REGISTRY
|
|
94
|
+
};
|
|
65
95
|
function logResolvedOption(label, opt) {
|
|
66
96
|
log(`${yellowBright(label)}: ${cyanBright(opt.value)} (override with: ${opt.environmentVariable})`);
|
|
67
97
|
}
|
|
68
|
-
function definitelyFind(collection,
|
|
69
|
-
const found = collection.find(
|
|
98
|
+
function definitelyFind(collection, key) {
|
|
99
|
+
const found = collection.find(o => o.option === key);
|
|
70
100
|
if (found) {
|
|
71
|
-
|
|
101
|
+
const result = found;
|
|
102
|
+
result.environmentVariable = envVarLookup[key];
|
|
72
103
|
}
|
|
73
|
-
throw new ZarroError(`Unable to find item with
|
|
104
|
+
throw new ZarroError(`Unable to find item with key: (${key})`);
|
|
74
105
|
}
|
|
75
106
|
module.exports = {
|
|
76
107
|
build,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
(function () {
|
|
4
|
-
const gutil = requireModule("gulp-util"), env = requireModule("env"), es = require("event-stream"), path = require("path"), testUtilFinder = requireModule("test-util-finder"), getToolsFolder = requireModule("get-tools-folder"), system =
|
|
4
|
+
const gutil = requireModule("gulp-util"), env = requireModule("env"), es = require("event-stream"), path = require("path"), testUtilFinder = requireModule("test-util-finder"), getToolsFolder = requireModule("get-tools-folder"), { system } = require("system-wrapper"), coverageTarget = process.env.COVERAGE_TARGET || "Debug", debug = requireModule("debug")(__filename), log = requireModule("log"), { mkdirSync, fileExistsSync } = require("yafs");
|
|
5
5
|
const PLUGIN_NAME = "gulp-dotnetcover";
|
|
6
6
|
function projectPathFor(p) {
|
|
7
7
|
return path.resolve(p);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
(function () {
|
|
4
|
-
const path = require("path"), gutil = requireModule("gulp-util"), es = require("event-stream"), system =
|
|
4
|
+
const path = require("path"), gutil = requireModule("gulp-util"), es = require("event-stream"), { system } = require("system-wrapper"), log = requireModule("log"), resolveNuget = requireModule("resolve-nuget"), env = requireModule("env"), isDotnetCore = env.resolveFlag("DOTNET_CORE"), os = require("os"), nugetExe = isDotnetCore
|
|
5
5
|
? (os.platform() === "win32" ? "dotnet.exe" : "dotnet")
|
|
6
6
|
: "nuget.exe", debug = requireModule("debug")(__filename);
|
|
7
7
|
const PLUGIN_NAME = "gulp-nuget-restore";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
(function () {
|
|
4
|
-
const quoteIfRequired = requireModule("quote-if-required"), system =
|
|
4
|
+
const quoteIfRequired = requireModule("quote-if-required"), { system } = require("system-wrapper"), defaultOptions = {
|
|
5
5
|
noConsoleLogger: false,
|
|
6
6
|
target: ["build"],
|
|
7
7
|
configuration: "Debug",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const resolveNuget = requireModule("resolve-nuget"), findLocalNuget = requireModule("find-local-nuget"), parseNugetSources = requireModule("parse-nuget-sources"), log = requireModule("log"), { mkdir } = require("yafs"), system =
|
|
3
|
+
const resolveNuget = requireModule("resolve-nuget"), findLocalNuget = requireModule("find-local-nuget"), parseNugetSources = requireModule("parse-nuget-sources"), log = requireModule("log"), { mkdir } = require("yafs"), system = require("system-wrapper"), { pushFlag, pushIfSet } = requireModule("cli-support");
|
|
4
4
|
const defaultInstallOptions = {
|
|
5
5
|
nonInteractive: true
|
|
6
6
|
};
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
async function listSources() {
|
|
62
62
|
const sysResult = await runNugetWith("", ["sources", "list"], { suppressOutput: true });
|
|
63
|
-
if (system.isError(sysResult)) {
|
|
63
|
+
if (system.system.isError(sysResult)) {
|
|
64
64
|
throw sysResult;
|
|
65
65
|
}
|
|
66
66
|
return parseNugetSources(sysResult.stdout);
|
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
}
|
|
141
141
|
const nuget = resolveNuget(undefined, false) ||
|
|
142
142
|
await findLocalNuget(true);
|
|
143
|
-
|
|
143
|
+
const result = await system.system(nuget, args, opts);
|
|
144
|
+
return result;
|
|
144
145
|
}
|
|
145
146
|
module.exports = {
|
|
146
147
|
install,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const system =
|
|
3
|
+
const { system } = require("system-wrapper"), quoteIfRequired = requireModule("quote-if-required"), { splitPath } = requireModule("path-utils"), dotnetCli = require("dotnet-cli"), env = requireModule("env"), resolveNugetApiKey = requireModule("resolve-nuget-api-key"), findLocalNuget = require("./find-local-nuget");
|
|
4
4
|
function isDotnetCore(binaryPath) {
|
|
5
5
|
const trimmed = binaryPath.replace(/^"/, "")
|
|
6
6
|
.replace(/"$/, ""), parts = splitPath(trimmed), executable = (parts[parts.length - 1] || "");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const os = require("os"), which = requireModule("which"), isWindows = os.platform() === "win32", path = require("path"), debug = requireModule("debug"), env = requireModule("env"), system =
|
|
3
|
+
const os = require("os"), which = requireModule("which"), isWindows = os.platform() === "win32", path = require("path"), debug = requireModule("debug"), env = requireModule("env"), system = require("system-wrapper");
|
|
4
4
|
let updating;
|
|
5
5
|
module.exports = function (nugetPath) {
|
|
6
6
|
if (env.resolveFlag("SKIP_NUGET_UPDATES")) {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
debug(`Requesting self-update from '${nugetPath}'`);
|
|
14
14
|
if (isWindows) {
|
|
15
15
|
try {
|
|
16
|
-
await system(nugetPath, ["update", "-self"], { suppressOutput: true });
|
|
16
|
+
await system.system(nugetPath, ["update", "-self"], { suppressOutput: true });
|
|
17
17
|
resolve();
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
}
|
|
32
32
|
try {
|
|
33
33
|
if (ext) {
|
|
34
|
-
await system("mono", [
|
|
34
|
+
await system.system("mono", [
|
|
35
35
|
nugetPath,
|
|
36
36
|
"update",
|
|
37
37
|
"-self"
|
|
38
38
|
], { suppressOutput: true });
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
await system(nugetPath, ["update", "-self"], { suppressOutput: true });
|
|
41
|
+
await system.system(nugetPath, ["update", "-self"], { suppressOutput: true });
|
|
42
42
|
}
|
|
43
43
|
resolve();
|
|
44
44
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
// open, but the author has kindly made it impossible to require
|
|
5
5
|
// from within zarro (I get an error about it being an ESM module);
|
|
6
6
|
// since my requirements are simple, I'll just roll my own.
|
|
7
|
-
const os = require("os"), ZarroError = requireModule("zarro-error"),
|
|
7
|
+
const os = require("os"), ZarroError = requireModule("zarro-error"), { system } = require("system-wrapper");
|
|
8
8
|
async function open(url) {
|
|
9
9
|
const opener = findOpenerForPlatform();
|
|
10
|
-
await
|
|
10
|
+
await system(opener, [url]);
|
|
11
11
|
}
|
|
12
12
|
function findOpenerForPlatform() {
|
|
13
13
|
switch (os.platform()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const env = requireModule("env"), log = requireModule("log"), { listNugetSources } =
|
|
3
|
+
const env = requireModule("env"), log = requireModule("log"), { listNugetSources } = require("dotnet-cli");
|
|
4
4
|
async function resolveNugetApiKey(source) {
|
|
5
5
|
const allKeys = resolveSourceToKeyLookup(), requestedSource = resolveSource(source);
|
|
6
6
|
if (!requestedSource) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const system =
|
|
3
|
+
const { system } = require("system-wrapper"), debug = requireModule("debug")(__filename), findLocalNuget = requireModule("find-local-nuget");
|
|
4
4
|
module.exports = async function (args, opts) {
|
|
5
5
|
const nuget = await findLocalNuget();
|
|
6
6
|
debug(`spawn nuget: ${nuget} ${args.join(" ")}`);
|
|
@@ -1,268 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ansi_colors_1 = require("ansi-colors");
|
|
4
2
|
(function () {
|
|
5
|
-
|
|
6
|
-
// use for spawning actual processes.
|
|
7
|
-
// You must use exec if you want to run batch files
|
|
8
|
-
const SpawnError = requireModule("spawn-error");
|
|
9
|
-
const SpawnResult = requireModule("spawn-result");
|
|
10
|
-
const tryLoadDebug = function () {
|
|
11
|
-
try {
|
|
12
|
-
return requireModule("debug")(__filename);
|
|
13
|
-
}
|
|
14
|
-
catch (e) {
|
|
15
|
-
return function () {
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}, quoteIfRequired = require("./quote-if-required"), debug = tryLoadDebug(), readline = require("readline"), child_process = require("child_process");
|
|
19
|
-
function clean(data) {
|
|
20
|
-
return (data || "").replace(/\s+$/, "");
|
|
21
|
-
}
|
|
22
|
-
function createEcho(writer) {
|
|
23
|
-
const buffer = new LineBuffer(writer);
|
|
24
|
-
const result = ((s) => {
|
|
25
|
-
buffer.append(s);
|
|
26
|
-
});
|
|
27
|
-
result.flush = () => buffer.flush();
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
const defaultOptions = {
|
|
31
|
-
stdio: [process.stdin, process.stdout, process.stdin],
|
|
32
|
-
cwd: process.cwd(),
|
|
33
|
-
shell: true,
|
|
34
|
-
lineBuffer: true,
|
|
35
|
-
// default is to echo outputs via a LineBuffer instance
|
|
36
|
-
// -> given captured console.xxx because then we can still
|
|
37
|
-
// spy and suppress and so on in tests
|
|
38
|
-
stderr: createEcho(s => console.log(s)),
|
|
39
|
-
stdout: createEcho(s => console.error(s))
|
|
40
|
-
};
|
|
41
|
-
// noinspection JSUnusedLocalSymbols
|
|
42
|
-
function nullConsumer(str) {
|
|
43
|
-
// intentionally left blank
|
|
44
|
-
}
|
|
45
|
-
function spawn(executable, commandlineArgs, options) {
|
|
46
|
-
const isShellExec = commandlineArgs === undefined || commandlineArgs === null;
|
|
47
|
-
let args = commandlineArgs || [];
|
|
48
|
-
if (isShellExec) {
|
|
49
|
-
debug("is shell exec");
|
|
50
|
-
debug({
|
|
51
|
-
executable
|
|
52
|
-
});
|
|
53
|
-
const os = require("os"), isWindows = os.platform() === "win32", commandLine = executable;
|
|
54
|
-
executable = isWindows
|
|
55
|
-
? "cmd"
|
|
56
|
-
: "/bin/bash";
|
|
57
|
-
args = [
|
|
58
|
-
isWindows ? "/c" : "-c",
|
|
59
|
-
commandLine
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
if (options) {
|
|
63
|
-
// if the provided options have properties with the value
|
|
64
|
-
// undefined, they will overwrite the defaults, which is
|
|
65
|
-
// likely not what the consumer expects
|
|
66
|
-
const o = options;
|
|
67
|
-
for (const k of Object.keys(o)) {
|
|
68
|
-
if (o[k] === undefined) {
|
|
69
|
-
delete o[k];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const opts = Object.assign(Object.assign({}, defaultOptions), options);
|
|
74
|
-
const q = opts.disableAutomaticQuoting
|
|
75
|
-
? passThrough
|
|
76
|
-
: quoteIfRequired;
|
|
77
|
-
if (opts.interactive) {
|
|
78
|
-
opts.stderr = undefined;
|
|
79
|
-
opts.stdout = undefined;
|
|
80
|
-
}
|
|
81
|
-
debug("running gulp");
|
|
82
|
-
if (!opts.stdio && defaultOptions.stdio /* this is just to make ts happy*/) {
|
|
83
|
-
opts.stdio = [...defaultOptions.stdio];
|
|
84
|
-
}
|
|
85
|
-
let stdOutWriter = nullConsumer, stdErrWriter = nullConsumer, stdoutFnSpecified = typeof opts.stdout === "function", stderrFnSpecified = typeof opts.stderr === "function";
|
|
86
|
-
let suppressStdOut = !!opts.suppressOutput, suppressStdErr = !!opts.suppressOutput;
|
|
87
|
-
if (opts.detached) {
|
|
88
|
-
opts.stdio = "ignore";
|
|
89
|
-
opts.stdout = undefined;
|
|
90
|
-
opts.stderr = undefined;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
if ((stdoutFnSpecified || stderrFnSpecified) &&
|
|
94
|
-
!Array.isArray(opts.stdio) &&
|
|
95
|
-
!!defaultOptions.stdio /* just to make ts happy */) {
|
|
96
|
-
opts.stdio = [...defaultOptions.stdio];
|
|
97
|
-
}
|
|
98
|
-
if (stdoutFnSpecified) {
|
|
99
|
-
stdOutWriter = opts.stdout;
|
|
100
|
-
opts.stdio[1] = "pipe";
|
|
101
|
-
}
|
|
102
|
-
else if (Array.isArray(opts.stdio)) {
|
|
103
|
-
opts.stdio[1] = "inherit";
|
|
104
|
-
}
|
|
105
|
-
if (stderrFnSpecified) {
|
|
106
|
-
stdErrWriter = opts.stderr;
|
|
107
|
-
opts.stdio[2] = "pipe";
|
|
108
|
-
}
|
|
109
|
-
else if (Array.isArray(opts.stdio)) {
|
|
110
|
-
opts.stdio[2] = "inherit";
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
disableLineBufferWhenUsingInternalLineBuffer(opts);
|
|
114
|
-
const result = new SpawnResult(executable, args, -1, [], []);
|
|
115
|
-
executable = q(executable);
|
|
116
|
-
const quotedArgs = args.map(s => q(s));
|
|
117
|
-
debug(`spawning: ${executable} ${quotedArgs.join(" ")}`);
|
|
118
|
-
debug({ opts });
|
|
119
|
-
return new Promise((resolve, reject) => {
|
|
120
|
-
try {
|
|
121
|
-
const child = child_process.spawn(executable, quotedArgs, opts);
|
|
122
|
-
if (!child) {
|
|
123
|
-
return reject(new Error(`unable to spawn ${executable} with args [${args.join(",")}]`));
|
|
124
|
-
}
|
|
125
|
-
if (opts.detached) {
|
|
126
|
-
return resolve(result);
|
|
127
|
-
}
|
|
128
|
-
debug(child);
|
|
129
|
-
const stdout = [];
|
|
130
|
-
const stderr = [];
|
|
131
|
-
child.on("error", (err) => {
|
|
132
|
-
debug(`child error: ${err}`);
|
|
133
|
-
destroyPipesOn(child);
|
|
134
|
-
const e = new SpawnError(`"${[executable].concat(args).join(" ")}" failed with "${err}"`, executable, quotedArgs, -1, opts.suppressStdIoInErrors ? null : stderr, opts.suppressStdIoInErrors ? null : stdout);
|
|
135
|
-
reject(e);
|
|
136
|
-
});
|
|
137
|
-
let exited = false;
|
|
138
|
-
child.on("exit", generateExitHandler("exit"));
|
|
139
|
-
child.on("close", generateExitHandler("close"));
|
|
140
|
-
let cleared = false;
|
|
141
|
-
const clearColorsOnce = () => {
|
|
142
|
-
if (cleared) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
cleared = true;
|
|
146
|
-
process.stdout.write((0, ansi_colors_1.reset)("\0"));
|
|
147
|
-
process.stderr.write((0, ansi_colors_1.reset)("\0"));
|
|
148
|
-
};
|
|
149
|
-
const outWriter = (s) => {
|
|
150
|
-
clearColorsOnce();
|
|
151
|
-
stdOutWriter(s);
|
|
152
|
-
};
|
|
153
|
-
const errWriter = (s) => {
|
|
154
|
-
clearColorsOnce();
|
|
155
|
-
stdErrWriter(s);
|
|
156
|
-
};
|
|
157
|
-
setupIoHandler(outWriter, child.stdout, stdout, opts, suppressStdOut);
|
|
158
|
-
setupIoHandler(errWriter, child.stderr, stderr, opts, suppressStdErr);
|
|
159
|
-
function flushWriters() {
|
|
160
|
-
tryFlush(stdOutWriter);
|
|
161
|
-
tryFlush(stdErrWriter);
|
|
162
|
-
}
|
|
163
|
-
function tryFlush(writer) {
|
|
164
|
-
const asAugmentedLog = writer;
|
|
165
|
-
if (!asAugmentedLog.flush) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
asAugmentedLog.flush();
|
|
169
|
-
}
|
|
170
|
-
function generateExitHandler(eventName) {
|
|
171
|
-
return (code) => {
|
|
172
|
-
if (exited) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
destroyPipesOn(child);
|
|
176
|
-
exited = true;
|
|
177
|
-
flushWriters();
|
|
178
|
-
debug(`child ${eventName}s: ${code}`);
|
|
179
|
-
result.exitCode = code;
|
|
180
|
-
result.stderr = stderr;
|
|
181
|
-
result.stdout = stdout;
|
|
182
|
-
if (code === 0) {
|
|
183
|
-
resolve(result);
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
const err = new SpawnError(`"${[executable]
|
|
187
|
-
.concat(args)
|
|
188
|
-
.join(" ")}" failed with exit code ${code}`, executable, args, code, opts.suppressStdIoInErrors ? null : stdout, opts.suppressStdIoInErrors ? null : stderr);
|
|
189
|
-
reject(err);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
catch (e) {
|
|
195
|
-
reject(`Unable to spawn process: ${e}\n${e.stack}`);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function setupIoHandler(writer, stream, collector, opts, suppress) {
|
|
200
|
-
if (!stream) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (!writer) {
|
|
204
|
-
writer = () => {
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function handle(data) {
|
|
208
|
-
if (data === undefined) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (data instanceof Buffer) {
|
|
212
|
-
data = data.toString();
|
|
213
|
-
}
|
|
214
|
-
collector.push(data);
|
|
215
|
-
if (suppress) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
writer(data);
|
|
219
|
-
}
|
|
220
|
-
if (opts.lineBuffer) {
|
|
221
|
-
const rl = readline.createInterface({ input: stream });
|
|
222
|
-
rl.on("line", handle);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
stream.on("data", handle);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
function destroyPipesOn(child) {
|
|
229
|
-
for (const pipe of [child.stdout, child.stderr, child.stdin]) {
|
|
230
|
-
if (pipe) {
|
|
231
|
-
try {
|
|
232
|
-
// I've seen times when child processes are dead, but the
|
|
233
|
-
// IO pipes are kept alive, preventing node from exiting.
|
|
234
|
-
// Specifically, when running dotnet test against a certain
|
|
235
|
-
// project - but not in any other project for the same
|
|
236
|
-
// usage. So this is just a bit of paranoia here - explicitly
|
|
237
|
-
// shut down any pipes on the child process - we're done
|
|
238
|
-
// with them anyway
|
|
239
|
-
pipe.destroy();
|
|
240
|
-
}
|
|
241
|
-
catch (e) {
|
|
242
|
-
// suppress: if the pipe is already dead, that's fine.
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
spawn.SpawnError = SpawnError;
|
|
248
|
-
spawn.SpawnResult = SpawnResult;
|
|
249
|
-
spawn.isSpawnError = function (o) {
|
|
250
|
-
return o instanceof SpawnError;
|
|
251
|
-
};
|
|
252
|
-
spawn.isSpawnResult = function (o) {
|
|
253
|
-
return o instanceof SpawnResult;
|
|
254
|
-
};
|
|
255
|
-
function passThrough(s) {
|
|
256
|
-
return s;
|
|
257
|
-
}
|
|
258
|
-
function disableLineBufferWhenUsingInternalLineBuffer(opts) {
|
|
259
|
-
const out = opts.stdout, err = opts.stderr;
|
|
260
|
-
if (!out || !err) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
if (!!out.flush || !!err.flush) {
|
|
264
|
-
opts.lineBuffer = false;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
module.exports = spawn;
|
|
3
|
+
throw new Error(`zarro module 'spawn' has been deprecated for a long time, now removed. Please use the npm package 'system-wrapper' for very similar functionality`);
|
|
268
4
|
})();
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
(function () {
|
|
4
4
|
const through = require("through2");
|
|
5
5
|
const PluginError = require("plugin-error");
|
|
6
|
-
const {
|
|
6
|
+
const { system } = require("system-wrapper");
|
|
7
7
|
function streamify(fn, optionsFactory, pluginName, operation) {
|
|
8
8
|
return through.obj(async function (file, enc, cb) {
|
|
9
9
|
try {
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
cb(null, file);
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
|
-
const pluginError =
|
|
15
|
+
const pluginError = system.isError(e)
|
|
16
16
|
? new PluginError(pluginName, `${operation} failed:\n${e.toString()}`)
|
|
17
17
|
: new PluginError(pluginName, `${operation} failed: ${e.message || e}`);
|
|
18
18
|
this.emit("error", pluginError);
|
|
@@ -20,26 +20,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function isSpawnError(e) {
|
|
24
|
-
return e instanceof SpawnError || looksLikeSpawnError(e);
|
|
25
|
-
}
|
|
26
|
-
/*
|
|
27
|
-
export interface SpawnError extends Error {
|
|
28
|
-
command: string;
|
|
29
|
-
args: string[] | undefined;
|
|
30
|
-
options: SpawnOptions | undefined;
|
|
31
|
-
result: ProcessData;
|
|
32
|
-
}
|
|
33
|
-
*/
|
|
34
|
-
function looksLikeSpawnError(e) {
|
|
35
|
-
if (!!e) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const se = e;
|
|
39
|
-
return typeof se.exe == typeof "" &&
|
|
40
|
-
typeof se.exitCode == typeof 1 &&
|
|
41
|
-
Array.isArray(se.args);
|
|
42
|
-
}
|
|
43
23
|
module.exports = {
|
|
44
24
|
streamify
|
|
45
25
|
};
|