Commit 00bee6c
committed
feat(cli): auto-dispose InstanceContext after effectCmd handlers
Wrap the user handler in Effect.ensuring(store.dispose(ctx)) inside the
effectCmd factory so per-command disposal is automatic — runs disposers
+ emits server.instance.disposed on every Exit (success / typed failure
/ defect / interruption). Matches the legacy bootstrap() finally without
14× hand-rolled boilerplate at the call sites.
Idempotent: existing commands that still call store.dispose(ctx) explicitly
inside their handler bodies will see the second auto-dispose call become a
no-op (cache entry already removed; disposeContext doesn't re-fire).1 parent 9bef88e commit 00bee6c
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
51 | 68 | | |
52 | 69 | | |
0 commit comments