package main

import (
	"context"
	"fmt"
	"os"
	"os/signal"
	"syscall"

	"banger/internal/cli"
)

func main() {
	// 0o077 ensures the firecracker API/vsock sockets (and any other files
	// the daemon or its children create) are user-private by default. The
	// previous shell wrapper around firecracker exec did this inline; with
	// the wrapper gone, the daemon process owns the umask.
	syscall.Umask(0o077)

	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
	defer stop()

	cmd := cli.NewBangerdCommand()
	if err := cmd.ExecuteContext(ctx); err != nil {
		fmt.Fprintf(os.Stderr, "bangerd: %v\n", err)
		os.Exit(1)
	}
}
