Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix signal handling (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed Aug 11, 2023
1 parent 932f631 commit 9491cb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/w3k/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (
"errors"
"flag"
"io/fs"
"io/ioutil"
"log"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"

cli "github.com/cristalhq/acmd"
)
Expand Down Expand Up @@ -107,7 +107,7 @@ var cmds = []cli.Command{
}

filename := cfg.File
code, err := ioutil.ReadFile(filename)
code, err := os.ReadFile(filename)
if err != nil {
return err
}
Expand Down Expand Up @@ -212,7 +212,7 @@ func sendCommand(c Command) error {
// append end of string to j
j = append(j, '\n')

err = ioutil.WriteFile("/dev/wasm", j, fs.ModeDevice)
err = os.WriteFile("/dev/wasm", j, fs.ModeDevice)
if err != nil {
return err
}
Expand All @@ -222,7 +222,7 @@ func sendCommand(c Command) error {

func main() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
os.Exit(0)
Expand Down

0 comments on commit 9491cb9

Please sign in to comment.