WindowsTaskService class

Runs the Hub/Node as a Windows Task Scheduler task instead of a Service Control Manager service.

A plain Dart console app cannot perform the in-process SCM handshake (StartServiceCtrlDispatcherSetServiceStatus), so registering it as an SCM service yields error 1053 ("did not respond to the start … in time"). Task Scheduler runs ordinary console programs as background daemons with no such requirement, so this backend drives schtasks.exe to install, control and query a boot/logon-triggered task that auto-restarts on failure.

Constructors

WindowsTaskService({ProcessRunner? runner})
Creates a Task Scheduler backend, optionally with a custom runner.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cleanStagedRuntime(String role) → void
Best-effort removal of the staged runtime(s) for role in the default (%LOCALAPPDATA%\OmnyShell\bin) location; called on uninstall.
install(ServiceDescriptor d, {bool force = false, bool startNow = true}) Future<void>
Installs (or, with force, replaces) the task for d and optionally starts it immediately.
logPathFor(ServiceDescriptor d) String
Resolves the log file path under serviceHomeDir, e.g. %LOCALAPPDATA%\OmnyShell\<role>.log.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(ServiceDescriptor d) String
Renders the XML and the schtasks create command for --dry-run.
restart(String role) Future<void>
Restarts the task for role.
runtimeDir(ServiceDescriptor d) String
The service-owned directory that holds the staged runtime copy.
serviceHomeDir(ServiceDescriptor d) String
The directory holding the service's per-role state: OMNYSHELL_HOME when the descriptor sets it, else %LOCALAPPDATA%\OmnyShell (falling back to %APPDATA%, then the system temp dir).
stagedDescriptor(ServiceDescriptor d) → ServiceDescriptor
d rewritten to launch the staged copy, without performing the copy (used by --dry-run). Returns d unchanged when it already points at the staged path.
stagedRuntimePath(ServiceDescriptor d) String
Where stageRuntime writes the private copy: <home>\bin\<role>-<file>.
stageRuntime(ServiceDescriptor d) → ServiceDescriptor
Copies d's runtime into runtimeDir and returns d rewritten to launch that private copy.
start(String role) Future<void>
Starts the installed task for role.
status(String role) Future<String>
Returns a short status word (running / ready / disabled / not installed / unknown) for role.
stop(String role) Future<void>
Stops the running task for role.
toString() String
A string representation of this object.
inherited
uninstall(String role) Future<void>
Stops and deletes the task for role.

Operators

operator ==(Object other) bool
The equality operator.
inherited