aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/outcome/process.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/outcome/process.go')
-rw-r--r--internal/outcome/process.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/outcome/process.go b/internal/outcome/process.go
index 78570d26..3aa4d0e2 100644
--- a/internal/outcome/process.go
+++ b/internal/outcome/process.go
@@ -33,7 +33,7 @@ const (
func NewStore(sc *hst.Paths) *store.Store { return store.New(sc.SharePath.Append("state")) }
// main carries out outcome and terminates. main does not return.
-func (k *outcome) main(msg message.Msg) {
+func (k *outcome) main(msg message.Msg, identifierFd int) {
if k.ctx == nil || k.sys == nil || k.state == nil {
panic("outcome: did not finalise")
}
@@ -163,6 +163,21 @@ func (k *outcome) main(msg message.Msg) {
continue
}
+ if f := os.NewFile(uintptr(identifierFd), "identifier"); f != nil {
+ _, err = f.Write(k.state.id.v[:])
+ if err != nil {
+ unlock()
+ // transition here to avoid the commit/revert cycle on the doomed instance
+ perrorFatal(&hst.AppError{Step: "write instance identifier", Err: err},
+ "write instance identifier", processLifecycle)
+ continue
+ }
+ msg.Verbosef("wrote identifier to %d", identifierFd)
+ if err = f.Close(); err != nil {
+ msg.Verbose(err.Error())
+ }
+ }
+
err = k.sys.Commit()
unlock()
if err != nil {