base.js 988 B

12345678910111213141516171819202122
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SSLBaseCommand = void 0;
  4. const utils_subprocess_1 = require("@ionic/utils-subprocess");
  5. const color_1 = require("../../lib/color");
  6. const command_1 = require("../../lib/command");
  7. const errors_1 = require("../../lib/errors");
  8. class SSLBaseCommand extends command_1.Command {
  9. async checkForOpenSSL() {
  10. try {
  11. await this.env.shell.run('openssl', ['version'], { stdio: 'ignore', showCommand: false, fatalOnNotFound: false });
  12. }
  13. catch (e) {
  14. if (!(e instanceof utils_subprocess_1.SubprocessError && e.code === utils_subprocess_1.ERROR_COMMAND_NOT_FOUND)) {
  15. throw e;
  16. }
  17. this.env.log.warn('OpenSSL not found on your computer.'); // TODO: more helpful message
  18. throw new errors_1.FatalException(`Command not found: ${(0, color_1.input)('openssl')}`);
  19. }
  20. }
  21. }
  22. exports.SSLBaseCommand = SSLBaseCommand;