refactor(daemon): share service arg types across backends

This commit is contained in:
Peter Steinberger
2026-02-19 10:03:09 +00:00
parent be7462af1e
commit 70900feaa7
5 changed files with 109 additions and 144 deletions

View File

@@ -1,4 +1,5 @@
import { splitArgsPreservingQuotes } from "./arg-split.js";
import type { GatewayServiceRenderArgs } from "./service-types.js";
function systemdEscapeArg(value: string): string {
if (!/[\\s"\\\\]/.test(value)) {
@@ -27,12 +28,7 @@ export function buildSystemdUnit({
programArguments,
workingDirectory,
environment,
}: {
description?: string;
programArguments: string[];
workingDirectory?: string;
environment?: Record<string, string | undefined>;
}): string {
}: GatewayServiceRenderArgs): string {
const execStart = programArguments.map(systemdEscapeArg).join(" ");
const descriptionLine = `Description=${description?.trim() || "OpenClaw Gateway"}`;
const workingDirLine = workingDirectory