// ĠCopyright Ġ 2 0 2 1 ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . ĠAll ĠRights ĠReserved . Ċ // ĠSPDX - License - Identifier : ĠApache - 2 . 0 Ċ Ċ package Ġsoftware . aws . tool k its . jetbrains . services . ecs . exec Ċ Ċ import Ġcom . intellij . execution . Execution Result Ċ import Ġcom . intellij . execution . Executor Ċ import Ġcom . intellij . execution . configurations . CommandLine State Ċ import Ġcom . intellij . execution . configurations . General CommandLine Ċ import Ġcom . intellij . execution . configurations . Run Profile Ċ import Ġcom . intellij . execution . configurations . Run Profile State Ċ import Ġcom . intellij . execution . filters . Text Console BuilderFactory Ċ import Ġcom . intellij . execution . process . Colo red Process Handler Ċ import Ġcom . intellij . execution . process . Process Adapter Ċ import Ġcom . intellij . execution . process . Process Event Ċ import Ġcom . intellij . execution . process . Process Handler Ċ import Ġcom . intellij . execution . process . Process Output Types Ċ import Ġcom . intellij . execution . process . Process Terminated Listener Ċ import Ġcom . intellij . execution . runners . Execution Environment Ċ import Ġcom . intellij . execution . runners . Program Runner Ċ import Ġcom . intellij . execution . ui . Run Content Manager Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . util . Key Ċ import Ġjavax . swing . Icon Ċ Ċ class ĠRun Command Run Profile ( ĊĠĠĠ Ġprivate Ġval Ġcredentials : ĠMap < String , ĠString >, ĊĠĠĠ Ġprivate Ġval Ġparameters : ĠString ?, ĊĠĠĠ Ġprivate Ġval Ġcontainer Name : ĠString , ĊĠĠĠ Ġprivate Ġval Ġpath : ĠString Ċ ) Ġ: ĠRun Profile Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠgetState ( executor : ĠExecutor , Ġenvironment : ĠExecution Environment ): ĠRun Profile State ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcmd Line Ġ= Ġget CommandLine () ĊĠĠĠĠĠĠĠ Ġval Ġproject Ġ= Ġenvironment . project ĊĠĠĠĠĠĠĠ Ġif Ġ( cmd Line Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcommand Line State Ġ= ĠCmd Line State ( environment , Ġcmd Line , Ġproject ) ĊĠĠĠĠĠĠĠ Ġval Ġbuilder Ġ= ĠText Console BuilderFactory . getInstance (). create Builder ( project ) ĊĠĠĠĠĠĠĠ Ġcommand Line State . console Builder Ġ= Ġbuilder ĊĠĠĠĠĠĠĠ Ġreturn Ġcommand Line State ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetName (): ĠString Ġ= Ġcontainer Name ĊĊĠĠĠ Ġoverride Ġfun Ġget Icon (): ĠIcon ? Ġ= Ġnull ĊĊĠĠĠ Ġfun Ġget CommandLine (): ĠGeneral CommandLine ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommand Line Ġ= ĠGeneral CommandLine () ĊĠĠĠĠĠĠĠ Ġcommand Line . parameters List . add Parameters String ( parameters ) ĊĠĠĠĠĠĠĠ Ġcommand Line . exe Path Ġ= Ġpath ĊĠĠĠĠĠĠĠ Ġcommand Line . with Environment ( credentials ) ĊĠĠĠĠĠĠĠ Ġreturn Ġcommand Line ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠCmd Line State ( ĊĠĠĠ Ġenvironment : ĠExecution Environment , ĊĠĠĠ Ġprivate Ġval Ġcmd Line : ĠGeneral CommandLine , ĊĠĠĠ Ġprivate Ġval Ġproject : ĠProject , Ċ ) Ġ: ĠCommandLine State ( environment ) Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġstart Process (): ĠProcess Handler Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprocess Handler Ġ= ĠCo lo red Process Handler ( cmd Line ) ĊĠĠĠĠĠĠĠ ĠProcess Terminated Listener . attach ( process Handler ) ĊĠĠĠĠĠĠĠ Ġreturn Ġprocess Handler ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġexecute ( executor : ĠExecutor , Ġrunner : ĠProgram Runner < *> ): ĠExecution Result Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġsuper . execute ( executor , Ġrunner ) ĊĠĠĠĠĠĠĠ Ġval Ġprocess Handler Ġ= Ġresult . process Handler ĊĠĠĠĠĠĠĠ Ġprocess Handler ?. add Process Listener ( object Ġ: ĠProcess Adapter () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġon Text Available ( event : ĠProcess Event , Ġoutput Type : ĠKey <* >) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( output Type Ġ=== ĠProcess Output Types . STDOUT Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġoutput Type Ġ=== ĠProcess Output Types . STD ERR ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRun Content Manager . getInstance ( project ). to Front Run Content ( executor , Ġprocess Handler ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġreturn Ġresult ĊĠĠĠ Ġ} Ċ } Ċ