Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Before killing the daemon, try a graceful shutdown
Otherwise the process will not outut the coverage data.
  • Loading branch information
cmaglie committed Mar 14, 2023
commit eacd81c5b35b381a24f6949de1c6720b5089c718
11 changes: 9 additions & 2 deletions internal/integrationtest/arduino-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type ArduinoCLI struct {
path *paths.Path
t *require.Assertions
proc *executils.Process
stdIn io.WriteCloser
cliEnvVars map[string]string
cliConfigPath *paths.Path
stagingDir *paths.Path
Expand Down Expand Up @@ -122,7 +123,12 @@ func NewArduinoCliWithinEnvironment(env *Environment, config *ArduinoCLIConfig)
func (cli *ArduinoCLI) CleanUp() {
if cli.proc != nil {
cli.daemonConn.Close()
cli.proc.Kill()
cli.stdIn.Close()
proc := cli.proc
go func() {
time.Sleep(time.Second)
proc.Kill()
}()
cli.proc.Wait()
}
}
Expand Down Expand Up @@ -251,10 +257,11 @@ func (cli *ArduinoCLI) StartDaemon(verbose bool) string {
cli.t.NoError(err)
stderr, err := cliProc.StderrPipe()
cli.t.NoError(err)
_, err = cliProc.StdinPipe()
stdIn, err := cliProc.StdinPipe()
cli.t.NoError(err)

cli.t.NoError(cliProc.Start())
cli.stdIn = stdIn
cli.proc = cliProc
cli.daemonAddr = "127.0.0.1:50051"

Expand Down