Browse Source

download commands modified

master
Juni Kim 1 year ago
parent
commit
bc433d8630
  1. 4
      main.go
  2. 1
      server.go

4
main.go

@ -15,11 +15,11 @@ var template []byte
func main() {
root := &cobra.Command{};
servecmd := &cobra.Command{
Use: "serve",
Use: "download",
Short: "server to listen for competitive companion requests",
Run: func(cmd *cobra.Command, args []string) {
port, _ := cmd.Flags().GetInt("port");
fmt.Println("Listning on port", port, "...")
fmt.Println("Listening on port", port, "...")
server(port);
},
}

1
server.go

@ -32,6 +32,7 @@ func server(port int) {
os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".input"), input, 0644);
os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".output"), output, 0644);
}
os.Exit(0);
})
http.ListenAndServe(fmt.Sprintf("127.0.0.1:%v", port), nil);
}
Loading…
Cancel
Save