@azure/identity
Version:
Provides credential implementations for Azure SDK libraries that can authenticate with Microsoft Entra ID
69 lines (68 loc) • 2.23 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var processUtils_exports = {};
__export(processUtils_exports, {
processUtils: () => processUtils
});
module.exports = __toCommonJS(processUtils_exports);
var import_core_process = require("@azure/core-process");
function outputToString(output) {
if (output === void 0) {
return "";
}
return Buffer.isBuffer(output) ? output.toString("utf8") : output;
}
const processUtils = {
/**
* Executes a file and preserves output when the process exits nonzero.
*
* @internal
*/
async execFileWithResult(file, params, options) {
try {
const result = await (0, import_core_process.execFile)(file, params, options);
return { ...result, error: null };
} catch (error) {
if ((0, import_core_process.isProcessError)(error)) {
return {
stdout: outputToString(error.stdout),
stderr: outputToString(error.stderr),
error
};
}
throw error;
}
},
/**
* Executes a file and rejects when it writes to stderr or exits nonzero.
*
* @internal
*/
async execFile(file, params, options) {
const { stdout, stderr, error } = await processUtils.execFileWithResult(file, params, options);
if (stderr || error) {
throw stderr ? new Error(stderr) : error;
}
return stdout;
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
processUtils
});
//# sourceMappingURL=processUtils.js.map