MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / Start

Method Start

pkg/genconn/ssh-impl.go:60–82  ·  view source on GitHub ↗

Start begins execution of the command

()

Source from the content-addressed store, hash-verified

58
59// Start begins execution of the command
60func (s *SSHProcessController) Start() error {
61 s.lock.Lock()
62 defer s.lock.Unlock()
63
64 if s.started {
65 return fmt.Errorf("command already started")
66 }
67
68 fullCmd, err := BuildShellCommand(s.cmdSpec)
69 if err != nil {
70 return fmt.Errorf("failed to build shell command: %w", err)
71 }
72 // if stdout/stderr weren't piped, then session.stdout/stderr will be nil
73 // and the library guarantees that the outputs will be attached to io.Discard
74 // if stdin hasn't been piped, then session.stdin will be nil
75 // and the libary guarantees that it will be attached to an empty bytes.Buffer, which will produce an immediate EOF
76 // tl;dr we don't need to worry about hanging beause of long input or explicitly closing stdin
77 if err := s.session.Start(fullCmd); err != nil {
78 return fmt.Errorf("failed to start command: %w", err)
79 }
80 s.started = true
81 return nil
82}
83
84// Wait waits for the command to complete
85func (s *SSHProcessController) Wait() error {

Callers

nothing calls this directly

Calls 2

BuildShellCommandFunction · 0.85
StartMethod · 0.65

Tested by

no test coverage detected