diff --git a/Makefile b/Makefile index f4790fec0..2ce03bebb 100644 --- a/Makefile +++ b/Makefile @@ -297,7 +297,11 @@ dev-setup: .PHONY: dev dev: app-cached $(LEXICON_STAMP) - if [ ! -d $(BUILDDIR) ]; then $(MAKE) dev-setup; fi + # static and friends reconfigure this same BUILDDIR with + # gstreamer:registry=false; a dev binary linked against those libs has no + # element factories at all. Re-apply the shared dev config on every run so + # dev self-heals after an interleaved static build. + if [ ! -d $(BUILDDIR) ]; then $(MAKE) dev-setup; else $(MAKE) dev-setup-meson; fi cp ./util/streamplace-dev.sh $(BUILDDIR)/streamplace $(MAKE) dev-rust PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) \ diff --git a/pkg/cmd/streamplace.go b/pkg/cmd/streamplace.go index 29cf6910e..0641b5437 100644 --- a/pkg/cmd/streamplace.go +++ b/pkg/cmd/streamplace.go @@ -109,10 +109,16 @@ func start(build *config.BuildFlags, platformJobs []jobFunc) error { } log.Log(ctx, "error in gstreamer self-test, attempting recovery", "error", err, "retry", retryCount+1) os.Setenv("STREAMPLACE_SELFTEST_RETRY", strconv.Itoa(retryCount+1)) - err := syscall.Exec(os.Args[0], os.Args[1:], os.Environ()) - if err != nil { - log.Error(ctx, "error in gstreamer self-test, could not restart", "error", err) - return ctx, err + // syscall.Exec does no PATH lookup, and the restarted process + // needs the program name at the front of argv; os.Executable() + // satisfies both regardless of how we were launched. + exe, exeErr := os.Executable() + if exeErr == nil { + exeErr = syscall.Exec(exe, os.Args, os.Environ()) + } + if exeErr != nil { + log.Error(ctx, "error in gstreamer self-test, could not restart", "error", exeErr) + return ctx, exeErr } panic("invalid code path: exec succeeded but we're still here???") }