package winrm
import "context"
type Shell struct {
client *Client
id string
}
func (s *Shell ) Execute (command string , arguments ...string ) (*Command , error ) {
return s .ExecuteWithContext (context .Background (), command , arguments ...)
}
func (s *Shell ) ExecuteWithContext (ctx context .Context , command string , arguments ...string ) (*Command , error ) {
request := NewExecuteCommandRequest (s .client .url , s .id , command , arguments , &s .client .Parameters )
defer request .Free ()
response , err := s .client .sendRequest (request )
if err != nil {
return nil , err
}
commandID , err := ParseExecuteCommandResponse (response )
if err != nil {
return nil , err
}
cmd := newCommand (ctx , s , commandID )
return cmd , nil
}
func (s *Shell ) Close () error {
request := NewDeleteShellRequest (s .client .url , s .id , &s .client .Parameters )
defer request .Free ()
_ , err := s .client .sendRequest (request )
return err
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .