<commit_before>package main

import (
	"log"
	"os"
	"os/exec"
	"strings"
	"time"

	"github.com/ogier/pflag"
)

func executeLocally(command string, args []string) error {
	log.Printf("Executing: %s %v", command, args)
	cmd := exec.Command(command, args...)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout
	defer log.Printf("done: %v", cmd.ProcessState)
	return cmd.Run()
}

var (
	serverAddr = pflag.String("server-addr", "", "Pass host:port to make it listen on http")
	hosts      = pflag.String("hosts", "", "Command separated list of hosts to work on")
)

func main() {
	pflag.Parse()

	srv := Service{executeLocally, &IPTables{}}

	if *serverAddr != "" {
		select {}
	} else {
		mode := pflag.Arg(0)
		if mode == "" {
			mode = "netsplit"
		}

		h := strings.Split(*hosts, ",")

		log.Println("Activating", mode)
		srv.Activate(mode, h, 10*time.Second)
	}<commit_msg>error handling<commit_after>package main

import (
	"log"
	"os"
	"os/exec"
	"strings"
	"time"

	"github.com/ogier/pflag"
)

func executeLocally(command string, args []string) error {
	log.Printf("Executing: %s %v", command, args)
	cmd := exec.Command(command, args...)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout
	defer log.Printf("done: %v", cmd.ProcessState)
	return cmd.Run()
}

var (
	serverAddr = pflag.String("server-addr", "", "Pass host:port to make it listen on http")
	hosts      = pflag.String("hosts", "", "Command separated list of hosts to work on")
)

func main() {
	pflag.Parse()

	srv := Service{executeLocally, &IPTables{}}

	if *serverAddr != "" {
		select {}
	} else {
		mode := pflag.Arg(0)
		if mode == "" {
			mode = "netsplit"
		}

		h := strings.Split(*hosts, ",")

		log.Println("Activating", mode)
		if err := srv.Activate(mode, h, 10*time.Second); err != nil {
			log.Fatalf("Failed to active %s: %v", mode, err)
		}
	}
{'fraction_non_alphanumeric': 0.17957166392092258, 'fraction_numerical': 0.0032948929159802307, 'mean_word_length': 3.7324675324675325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2569295', 'n_tokens_mistral': 728, 'n_tokens_neox': 688, 'n_words': 166}