pulumi/sdk/go/pulumi-language-go
Abhinav Gupta 2d3a1ecc3e
plugin(go, node, py): Exit cleanly on interrupt (#13809)
This changes the language plugins for Go, Node, and Python
to watch for the os.Interrupt signal (SIGINT on Unix, CTRL_BREAK on
Windows)
that the plugin lifetime manager sends (per #13795)
and exit cleanly on receiving the signal.

This is a no-op for users.
An immediate effect it'll have for us is that
we'll begin seeing test coverage data come out of these binaries.

A similar change is necessary in other language plugin binaries.
I did not touch uses of rpcutil.ServeWithOptions outside `main` packages
because whether a signal handler should be installed there or not
requires more knowledge of individual cases.

Note that this uses [signal.NotifyContext][1].
Calling the returned `cancel()` function removes the signal handler.
This is desirable so that if a user sends the signal again
(e.g., presses Ctrl-C again), we don't capture it
and let the OS kill the process.

  [1]: https://pkg.go.dev/os/signal#NotifyContext

Refs #9780
2023-08-29 15:42:31 +00:00
..
testdata/sample fix(host/go): Allow Pulumi program in a subdir of the module 2023-05-17 13:20:38 -07:00
go.mod Changelog and go.mod updates for v3.79.0 (#13794) 2023-08-26 00:21:43 +00:00
go.sum update aws-sdk to sso session supported version 2023-07-28 16:13:17 +00:00
main.go plugin(go, node, py): Exit cleanly on interrupt (#13809) 2023-08-29 15:42:31 +00:00
main_test.go fix(host/go): Download external plugins even if they're not imported 2023-07-11 16:22:15 -07:00