winsvc 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -270
- data/lib/winsvc.rb +4 -723
- metadata +11 -87
- data/CHANGELOG.md +0 -53
- data/ext/winsvc/extconf.rb +0 -22
- data/ext/winsvc/winsvc.c +0 -1162
- data/lib/winsvc/version.rb +0 -5
metadata
CHANGED
|
@@ -1,107 +1,30 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: winsvc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ned
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
requirements:
|
|
16
|
-
- - "~>"
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '13.0'
|
|
19
|
-
type: :development
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '13.0'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: rake-compiler
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '1.2'
|
|
33
|
-
type: :development
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.2'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: minitest
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - "~>"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '5.0'
|
|
47
|
-
type: :development
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - "~>"
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '5.0'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: vcvars
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - "~>"
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0.1'
|
|
61
|
-
- - ">="
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: 0.1.1
|
|
64
|
-
type: :development
|
|
65
|
-
prerelease: false
|
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
67
|
-
requirements:
|
|
68
|
-
- - "~>"
|
|
69
|
-
- !ruby/object:Gem::Version
|
|
70
|
-
version: '0.1'
|
|
71
|
-
- - ">="
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: 0.1.1
|
|
74
|
-
description: |
|
|
75
|
-
winsvc runs a Ruby process as a Windows service (SERVICE_WIN32_OWN_PROCESS)
|
|
76
|
-
with correct service-control-manager integration: the control handler is
|
|
77
|
-
pure C (no Ruby ever runs on an SCM thread), controls arrive on a
|
|
78
|
-
Thread::Queue (fiber-scheduler cooperative), SERVICE_STOPPED is reported
|
|
79
|
-
exactly once, and checkpoints are only ever honest. The same block runs
|
|
80
|
-
unchanged as a console program for development. Includes a minimal
|
|
81
|
-
installer (CreateServiceW, delayed auto-start, restart-on-failure recovery)
|
|
82
|
-
and a correctly quoted sc.exe command generator. Windows MSVC (mswin) Ruby
|
|
83
|
-
only.
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: winsvc is discontinued. This final release contains no code and exists
|
|
13
|
+
only so that installing winsvc explains the discontinuation instead of building
|
|
14
|
+
an unmaintained native extension.
|
|
84
15
|
executables: []
|
|
85
|
-
extensions:
|
|
86
|
-
- ext/winsvc/extconf.rb
|
|
16
|
+
extensions: []
|
|
87
17
|
extra_rdoc_files: []
|
|
88
18
|
files:
|
|
89
|
-
- CHANGELOG.md
|
|
90
19
|
- LICENSE.txt
|
|
91
20
|
- README.md
|
|
92
|
-
- ext/winsvc/extconf.rb
|
|
93
|
-
- ext/winsvc/winsvc.c
|
|
94
21
|
- lib/winsvc.rb
|
|
95
|
-
- lib/winsvc/version.rb
|
|
96
|
-
homepage: https://github.com/main-path/winsvc
|
|
97
22
|
licenses:
|
|
98
23
|
- MIT
|
|
99
24
|
metadata:
|
|
100
|
-
homepage_uri: https://github.com/main-path/winsvc
|
|
101
|
-
source_code_uri: https://github.com/main-path/winsvc
|
|
102
|
-
changelog_uri: https://github.com/main-path/winsvc/blob/main/CHANGELOG.md
|
|
103
|
-
bug_tracker_uri: https://github.com/main-path/winsvc/issues
|
|
104
25
|
rubygems_mfa_required: 'true'
|
|
26
|
+
post_install_message: winsvc is discontinued and this release contains no code. Use
|
|
27
|
+
win32-service, or a service wrapper such as WinSW, Servy or shawl instead.
|
|
105
28
|
rdoc_options: []
|
|
106
29
|
require_paths:
|
|
107
30
|
- lib
|
|
@@ -109,7 +32,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
109
32
|
requirements:
|
|
110
33
|
- - ">="
|
|
111
34
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '
|
|
35
|
+
version: '2.0'
|
|
113
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
37
|
requirements:
|
|
115
38
|
- - ">="
|
|
@@ -118,5 +41,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
118
41
|
requirements: []
|
|
119
42
|
rubygems_version: 3.6.9
|
|
120
43
|
specification_version: 4
|
|
121
|
-
summary:
|
|
44
|
+
summary: Discontinued. Use win32-service, or a service wrapper such as WinSW, Servy
|
|
45
|
+
or shawl instead.
|
|
122
46
|
test_files: []
|
data/CHANGELOG.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.1.0] - 2026-06-27
|
|
4
|
-
|
|
5
|
-
Initial release.
|
|
6
|
-
|
|
7
|
-
- **`Winsvc.run(name, accept:, start_wait_hint:, stop_wait_hint:, manual_ready:,
|
|
8
|
-
log:) { |svc| ... }`** — host a Ruby process as a
|
|
9
|
-
`SERVICE_WIN32_OWN_PROCESS` Windows service. The control handler is pure C (no
|
|
10
|
-
Ruby ever runs on an SCM thread); controls are marshalled through a fixed-size
|
|
11
|
-
C ring + kernel event into a real Ruby pump thread that drains them onto a
|
|
12
|
-
`Thread::Queue`. The identical block runs unchanged as a **console program**
|
|
13
|
-
(dispatcher failure 1063 ⇒ console mode), where Ctrl-C/Ctrl-Break injects a
|
|
14
|
-
synthetic `:stop` and a second Ctrl-C terminates. `SERVICE_STOPPED` is reported
|
|
15
|
-
**exactly once**, from `ServiceMain`, after Ruby has fully unwound; every
|
|
16
|
-
status report executes atomically under one host critical section. A block
|
|
17
|
-
exception writes its backtrace to the log and flushes it **before** STOPPED,
|
|
18
|
-
then reports `1066`/specific `1` and re-raises.
|
|
19
|
-
- **`Winsvc::Service`** — the yielded object: `wait(timeout:)` (parks the fiber
|
|
20
|
-
under a scheduler, blocks the thread without one), `stop_requested?`
|
|
21
|
-
(interlocked, earlier than queue delivery), `each_control`, `ready!` /
|
|
22
|
-
`running!` / `paused!` / `checkpoint!(wait_hint:)` (no-ops in console mode,
|
|
23
|
-
after a latched stop, and after STOPPED — guarded under the host lock),
|
|
24
|
-
`args` (start parameters / ARGV), `service?` / `console?`.
|
|
25
|
-
- **`Winsvc::Control`** — a frozen struct (`control`, `event_type`, `session_id`,
|
|
26
|
-
`data`, `time`, `stop?`) for `:stop`, `:shutdown`, `:preshutdown`, `:pause`,
|
|
27
|
-
`:continue`, `:power` (raw `POWERBROADCAST_SETTING` bytes, ≤ 512, truncated),
|
|
28
|
-
and `:session_change` (`WTS_*` + session id).
|
|
29
|
-
- **`Winsvc.install` / `Winsvc.uninstall` / `Winsvc.install_command`** — a
|
|
30
|
-
minimal installer over `CreateServiceW` with `:demand` / `:auto` /
|
|
31
|
-
`:delayed_auto` start, account/password, description, `preshutdown_timeout:`,
|
|
32
|
-
and `restart_on_failure:` (three `SC_ACTION_RESTART` entries +
|
|
33
|
-
failure-actions-on-non-crash flag, composing with the 1066 exception exit).
|
|
34
|
-
`install` composes binPath with correct quoting and refuses embedded double
|
|
35
|
-
quotes; config-step failures roll the create back via `DeleteService`.
|
|
36
|
-
`uninstall` stops the service first (bounded poll, retrying 1061/1062) and
|
|
37
|
-
raises `TimeoutError` rather than zombifying a running service.
|
|
38
|
-
`install_command` emits the correctly quoted `sc.exe` incantation(s) and is a
|
|
39
|
-
pure function sharing the binPath composer with `install`.
|
|
40
|
-
- **Cooperative under [winloop](https://github.com/main-path/winloop)** with zero
|
|
41
|
-
winloop-specific code — the integration point is `Thread::Queue`. Blocking C
|
|
42
|
-
waits release the GVL with a cancel-capable unblock function, so `Thread#kill` /
|
|
43
|
-
Ctrl-C / VM shutdown break them.
|
|
44
|
-
- Error taxonomy under `Winsvc::Error`: `OSError` (with `#code`) → `AccessDenied`,
|
|
45
|
-
`Exists`, `NotFound`, `MarkedForDelete`, `TimeoutError`; plus `StateError` for
|
|
46
|
-
API misuse.
|
|
47
|
-
|
|
48
|
-
Pure C extension over advapi32 (+ kernel32) — `rb_raise`/longjmp-safe; native
|
|
49
|
-
state is a documented process singleton (one `StartServiceCtrlDispatcherW` per
|
|
50
|
-
process, ever). Requires Ruby **3.2+** (`Thread::Queue#pop(timeout:)`). Windows
|
|
51
|
-
MSVC (mswin) Ruby only.
|
|
52
|
-
|
|
53
|
-
[0.1.0]: https://github.com/main-path/winsvc/releases/tag/v0.1.0
|
data/ext/winsvc/extconf.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# extconf.rb for the winsvc extension — hosts a Ruby process as a Windows
|
|
4
|
-
# service (SERVICE_WIN32_OWN_PROCESS) with correct SCM integration.
|
|
5
|
-
|
|
6
|
-
require "mkmf"
|
|
7
|
-
|
|
8
|
-
unless RbConfig::CONFIG["target_os"] =~ /mswin/
|
|
9
|
-
abort <<~MSG
|
|
10
|
-
winsvc requires a native Windows MSVC (mswin) Ruby — it binds the Windows
|
|
11
|
-
service control manager (StartServiceCtrlDispatcherW / SetServiceStatus /
|
|
12
|
-
CreateServiceW) and is built with cl.exe. Your Ruby is "#{RbConfig::CONFIG['arch']}".
|
|
13
|
-
MSG
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Pure C — no -EHsc, so rb_raise/longjmp is the normal, safe error mechanism.
|
|
17
|
-
# System import libs (bare "NAME.lib" tokens on mswin); kernel32 (events, CS,
|
|
18
|
-
# _beginthreadex via the CRT) is linked by default:
|
|
19
|
-
# advapi32 - all winsvc.h APIs (dispatcher, handler registration, status, SCM client)
|
|
20
|
-
$libs = [$libs, "advapi32.lib"].join(" ")
|
|
21
|
-
|
|
22
|
-
create_makefile("winsvc/winsvc")
|