feat: Harbour-compatible VM shutdown sequence

Implements full cleanup on program exit (normal, Ctrl+C, crash):
- EXIT PROCEDURE auto-execution (reverse module order)
- AtExit callback registry (LIFO order)
- All WorkAreas auto-close (child before parent)
- Terminal restore (raw → normal) on signal/exit
- Static variables clear
- Signal handlers (SIGINT, SIGTERM) for clean shutdown
- shutdown.go: Harbour hb_vmQuit() 25-step sequence adapted for Five
- vm.go: Run() now calls Shutdown() via defer
- rawtty.go: terminal restore registered with shutdown system

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 10:07:42 +09:00
parent d774f1598c
commit 272576f6ce
5 changed files with 286 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
{
"version": "2.0",
"lastUpdated": "2026-03-30T23:17:34.469Z",
"lastUpdated": "2026-03-31T01:06:49.182Z",
"activeFeatures": [
"hbrt",
"hbrtl",
@@ -32,9 +32,9 @@
"documents": {},
"timestamps": {
"started": "2026-03-27T09:33:04.512Z",
"lastUpdated": "2026-03-30T23:17:34.469Z"
"lastUpdated": "2026-03-31T01:05:45.128Z"
},
"lastFile": "/mnt/d/charles/five/hbrt/macroeval_test.go"
"lastFile": "/mnt/d/charles/five/hbrt/vm.go"
},
"hbrtl": {
"phase": "do",
@@ -45,9 +45,9 @@
"documents": {},
"timestamps": {
"started": "2026-03-27T11:15:10.675Z",
"lastUpdated": "2026-03-29T13:02:52.259Z"
"lastUpdated": "2026-03-31T01:06:49.182Z"
},
"lastFile": "/mnt/d/charles/five/hbrtl/json_test.go"
"lastFile": "/mnt/d/charles/five/hbrtl/rawtty.go"
},
"tests": {
"phase": "do",
@@ -266,7 +266,7 @@
"session": {
"startedAt": "2026-03-27T06:06:49.620Z",
"onboardingCompleted": false,
"lastActivity": "2026-03-30T23:17:34.469Z"
"lastActivity": "2026-03-31T01:06:49.182Z"
},
"history": [
{
@@ -5290,6 +5290,42 @@
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:04:07.876Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:04:54.144Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:05:27.088Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:05:45.128Z",
"feature": "hbrt",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:06:16.666Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
},
{
"timestamp": "2026-03-31T01:06:49.182Z",
"feature": "hbrtl",
"phase": "do",
"action": "updated"
}
]
}