"use strict";var t=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,o){function c(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(c,s)}u((r=r.apply(t,e||[])).next())}))},e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.scriptCmd=void 0;const i=require("../util"),r=require("../common/message"),n=require("../core/scripts/script"),o=require("../core/scripts/ScriptRunner"),c=require("../config"),s=require("../core/install/common/OptionValid"),u=e(require("../log"));exports.scriptCmd=function(e,p,a){return t(this,void 0,void 0,(function*(){const t=(new Date).getTime();try{(0,s.validPrefixOptions)("script",a);const f=yield(0,n.script)(e,p,c.config.getRootDir());(0,i.output)(""),f?i.PrintUtil.printCostTime(t,"> Run script"):(o.ScriptRunner.errOut(e,r.Messages.Script.Fail,c.config.getRootDir()),u.default.shutdown((()=>process.exit(1))))}catch(t){o.ScriptRunner.errOut(e,t,c.config.getRootDir()),u.default.shutdown((()=>process.exit(1)))}}))};