- Bump dappco.re/go/* deps to v0.8.0-alpha.1 in go.mod (any forge.lthn.ai/core/* paths migrated to canonical dappco.re/go/* form) - Update Go source imports across 29 .go files - Add tests/cli/agent/Taskfile.yaml AX-10 scaffold (build/vet/test under default deps), per RFC-CORE-008-AGENT-EXPERIENCE.md §10 Co-Authored-By: Athena <athena@lthn.ai>
41 lines
949 B
Go
41 lines
949 B
Go
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
package agentic
|
|
|
|
import (
|
|
"context"
|
|
|
|
core "dappco.re/go/core"
|
|
"dappco.re/go/process"
|
|
)
|
|
|
|
func ExampleProcessAlive() {
|
|
r := testCore.Process().Start(context.Background(), core.NewOptions(
|
|
core.Option{Key: "command", Value: "sleep"},
|
|
core.Option{Key: "args", Value: []string{"1"}},
|
|
core.Option{Key: "detach", Value: true},
|
|
))
|
|
if !r.OK {
|
|
return
|
|
}
|
|
proc := r.Value.(*process.Process)
|
|
defer proc.Kill()
|
|
|
|
core.Println(ProcessAlive(testCore, proc.ID, proc.Info().PID))
|
|
// Output: true
|
|
}
|
|
|
|
func ExampleProcessTerminate() {
|
|
r := testCore.Process().Start(context.Background(), core.NewOptions(
|
|
core.Option{Key: "command", Value: "sleep"},
|
|
core.Option{Key: "args", Value: []string{"1"}},
|
|
core.Option{Key: "detach", Value: true},
|
|
))
|
|
if !r.OK {
|
|
return
|
|
}
|
|
proc := r.Value.(*process.Process)
|
|
defer proc.Kill()
|
|
core.Println(ProcessTerminate(testCore, proc.ID, proc.Info().PID))
|
|
// Output: true
|
|
}
|