Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a signal handler to pause. #1563

Merged
merged 1 commit into from
Oct 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions build/pause/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ limitations under the License.

package main

import "syscall"
import (
"os"
"os/signal"
"syscall"
)

func main() {
// Halts execution, waiting on signal.
syscall.Pause()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)

// Block until a signal is received.
<-c
}
5 changes: 5 additions & 0 deletions build/pause/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
set -e
set -x

# Build the binary.
go build --ldflags '-extldflags "-static" -s' pause.go

# Run goupx to shrink binary size.
go get github.com/pwaller/goupx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does running go get ... also get the upx command, which appears to be separate? If not, is this going to break for people that don't have upx installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will break for those without the upx command. We can add a note,
but since installation is distro-specific and this is not a binary commonly
build, I think that should be okay.
On Oct 6, 2014 11:53 AM, "erictune" notifications@github.com wrote:

In build/pause/prepare.sh:

go build --ldflags '-extldflags "-static" -s' pause.go
+
+# Run goupx to shrink binary size.
+go get github.com/pwaller/goupx

does running go get ... also get the upx command, which appears to be
separate? If not, is this going to break for people that don't have upx
installed?


Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/kubernetes/pull/1563/files#r18465140
.

goupx pause