aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/hpkg/proc.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-29 02:33:10 +0900
committerOphestra <cat@gensokyo.uk>2025-09-29 06:11:47 +0900
commit46cd3a28c83e93b5d66c52d06a8366c11910d5c0 (patch)
tree6e25c5078b5cd9de78b7a6c9b253f1132358812b /cmd/hpkg/proc.go
parentad1bc6794f0053c3e63eab408a0d530d53e8b51c (diff)
container: remove global msg
This frees all container instances of side effects. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/hpkg/proc.go')
-rw-r--r--cmd/hpkg/proc.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd/hpkg/proc.go b/cmd/hpkg/proc.go
index d374e13d..1bbf5b49 100644
--- a/cmd/hpkg/proc.go
+++ b/cmd/hpkg/proc.go
@@ -9,14 +9,14 @@ import (
"os"
"os/exec"
+ "hakurei.app/container"
"hakurei.app/hst"
"hakurei.app/internal"
- "hakurei.app/internal/hlog"
)
var hakureiPath = internal.MustHakureiPath()
-func mustRunApp(ctx context.Context, config *hst.Config, beforeFail func()) {
+func mustRunApp(ctx context.Context, msg container.Msg, config *hst.Config, beforeFail func()) {
var (
cmd *exec.Cmd
st io.WriteCloser
@@ -26,10 +26,10 @@ func mustRunApp(ctx context.Context, config *hst.Config, beforeFail func()) {
beforeFail()
log.Fatalf("cannot pipe: %v", err)
} else {
- if hlog.Load() {
- cmd = exec.CommandContext(ctx, hakureiPath, "-v", "app", "3")
+ if msg.IsVerbose() {
+ cmd = exec.CommandContext(ctx, hakureiPath.String(), "-v", "app", "3")
} else {
- cmd = exec.CommandContext(ctx, hakureiPath, "app", "3")
+ cmd = exec.CommandContext(ctx, hakureiPath.String(), "app", "3")
}
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
cmd.ExtraFiles = []*os.File{r}
@@ -51,7 +51,8 @@ func mustRunApp(ctx context.Context, config *hst.Config, beforeFail func()) {
var exitError *exec.ExitError
if errors.As(err, &exitError) {
beforeFail()
- internal.Exit(exitError.ExitCode())
+ msg.BeforeExit()
+ os.Exit(exitError.ExitCode())
} else {
beforeFail()
log.Fatalf("cannot wait: %v", err)