mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
* addHealthCheck on Daemons * fix bug that prevents domains without protocols from being deleted * fixes from testing * version bump * add sdk version to UI * fix useEntrypoint * fix dependency health check error display * minor fixes * beta.29 * fixes from testing * beta.30 * set /etc/os-release (#2918) * remove check-monitor from kiosk (#2059) * add units for progress (#2693) * use new progress type * alpha.7 * fix up pwa stuff * fix wormhole-squashfs and prune boot (#2964) * don't exit on expected errors * use bash --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import * as T from "../../../base/lib/types"
|
|
import { SubContainer, SubContainerOwned } from "../util/SubContainer"
|
|
import { CommandController } from "./CommandController"
|
|
import { Daemon } from "./Daemon"
|
|
import { DaemonCommandType } from "./Daemons"
|
|
|
|
/**
|
|
* This is a wrapper around CommandController that has a state of off, where the command shouldn't be running
|
|
* and the others state of running, where it will keep a living running command
|
|
* unlike Daemon, does not restart on success
|
|
*/
|
|
|
|
export class Oneshot<
|
|
Manifest extends T.SDKManifest,
|
|
C extends SubContainer<Manifest> | null = SubContainer<Manifest> | null,
|
|
> extends Daemon<Manifest, C> {
|
|
static of<Manifest extends T.SDKManifest>() {
|
|
return async <C extends SubContainer<Manifest> | null>(
|
|
effects: T.Effects,
|
|
subcontainer: C,
|
|
exec: DaemonCommandType<Manifest, C>,
|
|
) => {
|
|
let subc: SubContainer<Manifest> | null = subcontainer
|
|
if (subcontainer && subcontainer.isOwned()) subc = subcontainer.rc()
|
|
const startCommand = () =>
|
|
CommandController.of<Manifest, C>()(
|
|
effects,
|
|
(subc?.rc() ?? null) as C,
|
|
exec,
|
|
)
|
|
return new Oneshot<Manifest, C>(subcontainer, startCommand, true)
|
|
}
|
|
}
|
|
}
|