func (p *InteractiveCommandsPlugin) Execute(context context.T,
	config agentContracts.Configuration,
	cancelFlag task.CancelFlag,
	output iohandler.IOHandler,
	dataChannel datachannel.IDataChannel) {

	logger := context.Log()
	var shellProps mgsContracts.ShellProperties
	err := jsonutil.Remarshal(config.Properties, &shellProps)
	logger.Debugf("Plugin properties %v", shellProps)
	if err != nil {
		sessionPluginResultOutput := mgsContracts.SessionPluginResultOutput{}
		output.SetExitCode(appconfig.ErrorExitCode)
		output.SetStatus(agentContracts.ResultStatusFailed)
		sessionPluginResultOutput.Output = fmt.Sprintf("Invalid format in session properties %v;\nerror %v", config.Properties, err)
		output.SetOutput(sessionPluginResultOutput)
		logger.Error(sessionPluginResultOutput.Output)
		return
	}

	if err := p.validateProperties(shellProps); err != nil {
		sessionPluginResultOutput := mgsContracts.SessionPluginResultOutput{}
		output.SetExitCode(appconfig.ErrorExitCode)
		output.SetStatus(agentContracts.ResultStatusFailed)
		sessionPluginResultOutput.Output = err.Error()
		output.SetOutput(sessionPluginResultOutput)
		logger.Error(sessionPluginResultOutput.Output)
		return
	}

	p.shell.Execute(context, config, cancelFlag, output, dataChannel, shellProps)
}
// Execute starts pseudo terminal.
// It reads incoming message from data channel and writes to pty.stdin.
// It reads message from pty.stdout and writes to data channel
Execute starts pseudo terminal.
It reads incoming message from data channel and writes to pty.stdin.
It reads message from pty.stdout and writes to data channel
// Execute starts pseudo terminal . // It reads incoming message from data channel and writes to pty . stdin . // It reads message from pty . stdout and writes to data channel
func (p *InteractiveCommandsPlugin) Execute(context context.T,
	config agentContracts.Configuration,
	cancelFlag task.CancelFlag,
	output iohandler.IOHandler,
	dataChannel datachannel.IDataChannel) {
	logger := context.Log()
	var shellProps mgsContracts.ShellProperties
	err := jsonutil.Remarshal(config.Properties, &shellProps)
	logger.Debugf("Plugin properties %v", shellProps)
	if err != nil {
		sessionPluginResultOutput := mgsContracts.SessionPluginResultOutput{}
		output.SetExitCode(appconfig.ErrorExitCode)
		output.SetStatus(agentContracts.ResultStatusFailed)
		sessionPluginResultOutput.Output = fmt.Sprintf("Invalid format in session properties %v;\nerror %v", config.Properties, err)
		output.SetOutput(sessionPluginResultOutput)
		logger.Error(sessionPluginResultOutput.Output)
		return
	}
	if err := p.validateProperties(shellProps); err != nil {
		sessionPluginResultOutput := mgsContracts.SessionPluginResultOutput{}
		output.SetExitCode(appconfig.ErrorExitCode)
		output.SetStatus(agentContracts.ResultStatusFailed)
		sessionPluginResultOutput.Output = err.Error()
		output.SetOutput(sessionPluginResultOutput)
		logger.Error(sessionPluginResultOutput.Output)
		return
	}
	p.shell.Execute(context, config, cancelFlag, output, dataChannel, shellProps)
}
func ( p * InteractiveCommandsPlugin ) Execute ( context context . T , config agentContracts . Configuration , cancelFlag task . CancelFlag , output iohandler . IOHandler , dataChannel datachannel . IDataChannel ) { logger := context . Log ( ) var shellProps mgsContracts . ShellProperties err := jsonutil . Remarshal ( config . Properties , & shellProps ) logger . Debugf ( " " , shellProps ) if err != nil { sessionPluginResultOutput := mgsContracts . SessionPluginResultOutput { } output . SetExitCode ( appconfig . ErrorExitCode ) output . SetStatus ( agentContracts . ResultStatusFailed ) sessionPluginResultOutput . Output = fmt . Sprintf ( " \n " , config . Properties , err ) output . SetOutput ( sessionPluginResultOutput ) logger . Error ( sessionPluginResultOutput . Output ) return } if err := p . validateProperties ( shellProps ) ; err != nil { sessionPluginResultOutput := mgsContracts . SessionPluginResultOutput { } output . SetExitCode ( appconfig . ErrorExitCode ) output . SetStatus ( agentContracts . ResultStatusFailed ) sessionPluginResultOutput . Output = err . Error ( ) output . SetOutput ( sessionPluginResultOutput ) logger . Error ( sessionPluginResultOutput . Output ) return } p . shell . Execute ( context , config , cancelFlag , output , dataChannel , shellProps ) }
Execute starts pseudo terminal.
Execute starts pseudo terminal .