Remove PIDFile, HealthServer, Daemon, DaemonOptions, HealthCheck, Run, and RunWithTimeout from daemon.go — all now live in go-process. Retain Mode type (ModeInteractive/ModePipe/ModeDaemon), DetectMode(), IsTTY(), IsStdinTTY(), and IsStderrTTY() as CLI-specific helpers. Co-Authored-By: Virgil <virgil@lethean.io>
21 lines
493 B
Go
21 lines
493 B
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDetectMode(t *testing.T) {
|
|
t.Run("daemon mode from env", func(t *testing.T) {
|
|
t.Setenv("CORE_DAEMON", "1")
|
|
assert.Equal(t, ModeDaemon, DetectMode())
|
|
})
|
|
|
|
t.Run("mode string", func(t *testing.T) {
|
|
assert.Equal(t, "interactive", ModeInteractive.String())
|
|
assert.Equal(t, "pipe", ModePipe.String())
|
|
assert.Equal(t, "daemon", ModeDaemon.String())
|
|
assert.Equal(t, "unknown", Mode(99).String())
|
|
})
|
|
}
|