Go Blocking the Main Thread until Ctrl-C is Entered

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

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

func waitForCtrlC() {
  c := make(chan os.Signal, 1)
  signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
  <-c
}