Keep model compilation headless (#49)
build-binaries / build-binaries (push) Successful in 2m14s
build-binaries / build-binaries (push) Successful in 2m14s
## Summary - always wrap NWN model compilation with `xvfb-run`, even when the caller has `DISPLAY` - fail closed with an actionable error when `xvfb-run` is unavailable instead of opening the client UI - update the compiler contract and regression coverage ## Verification - focused red/green regression tests - `nix develop -c make check` - real NWN compile with `DISPLAY=:0` under transient Xvfb; binary MDL output verified Generated with Claude CodeReviewed-on: #49 Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #49.
This commit is contained in:
@@ -40,13 +40,13 @@ func runCompile(args []string, stdout, stderr io.Writer, getenv func(string) str
|
||||
}
|
||||
binDir := filepath.Dir(nwmain)
|
||||
|
||||
// Headless wrap: no DISPLAY + xvfb-run present -> run under a virtual X.
|
||||
var wrap []string
|
||||
if getenv("DISPLAY") == "" {
|
||||
if xvfb := look("xvfb-run"); xvfb != "" {
|
||||
wrap = []string{xvfb, "-a", "--server-args=-screen 0 1024x768x24"}
|
||||
}
|
||||
// Always use a virtual X so compilation never opens the client UI.
|
||||
xvfb := look("xvfb-run")
|
||||
if xvfb == "" {
|
||||
fmt.Fprintln(stderr, "assets compile: xvfb-run not found — install it to run the NWN model compiler headlessly")
|
||||
return exitTool
|
||||
}
|
||||
wrap := []string{xvfb, "-a", "--server-args=-screen 0 1024x768x24"}
|
||||
|
||||
files, err := walk(dirs, mdlExt, !*nonRecursive)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user