23 lines
955 B
JavaScript
23 lines
955 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Oneshot = void 0;
|
|
const CommandController_1 = require("./CommandController");
|
|
const Daemon_1 = require("./Daemon");
|
|
/**
|
|
* 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
|
|
*/
|
|
class Oneshot extends Daemon_1.Daemon {
|
|
static of() {
|
|
return (effects, subcontainer, exec) => {
|
|
let subc = subcontainer;
|
|
if (subcontainer && subcontainer.isOwned())
|
|
subc = subcontainer.rc();
|
|
const startCommand = () => CommandController_1.CommandController.of()(effects, (subc?.rc() ?? null), exec);
|
|
return new Oneshot(subcontainer, startCommand, true);
|
|
};
|
|
}
|
|
}
|
|
exports.Oneshot = Oneshot;
|
|
//# sourceMappingURL=Oneshot.js.map
|