import { $ } from "bun" import { apps } from "../src/webapp" const { stdout: ipRaw } = await $`hostname -I | awk '{print $1}'`.quiet() const { stdout: hostRaw } = await $`hostname`.quiet() const ip = ipRaw.toString().trim() const host = hostRaw.toString().trim() console.log(apps().map(app => `avahi-publish -a ${app}.${host}.local -R ${ip}`).join("\n")) const procs = apps().map(app => Bun.spawn(["avahi-publish", "-a", `${app}.${host}.local`, "-R", ip]) ) for (const p of procs) p.exited.then(code => console.log(`avahi-publish (${p.pid}) exited with code ${code}`) ) await new Promise(() => { })