Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Nov 16, 2024
1 parent 1d8193b commit 6e0582e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 13 additions & 3 deletions examples/echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"flag"
"io"
"os"

"github.com/wetware/go/std/system"
)

//export echo
Expand All @@ -25,8 +27,16 @@ func main() {
}

if *serve {
// Signal to caller that this module is ready to handle
// incoming method calls.
os.Exit(0x00ff0000)
// Yield control to the scheduler.
os.Exit(system.StatusAwaiting)
// The caller will intercept interface{ExitCode() uint32} and
// check if e.ExitCode() == system.StatusAwaiting.
//
// The top-level command will block until the runtime context
// expires.
}

// Implicit status code 0 works as expected.
// Caller will resolve to err = nil.
// Top-level CLI command will unblock.
}
3 changes: 3 additions & 0 deletions std/system/system.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package system

const StatusAwaiting = 0x00ff0000

0 comments on commit 6e0582e

Please sign in to comment.