<commit_before>package god

import (
	"github.com/vanng822/gopid"
	"log"
	"os"
	"os/signal"
	"runtime"
	"syscall"
)

type Goz struct {
	gods []*God
}

func NewGoz() *Goz {
	z := new(Goz)
	z.gods = make([]*God, 0)
	return z
}

func (z *Goz) Add(d *God) {
	z.gods = append(z.gods, d)
}

func (z *Goz) Start() {
	args := Args{}

	if err := args.Parse(os.Args[1:]); err != nil || args.help || len(args.programs) == 0 {
		usage()
		os.Exit(0)
	}

	if args.pidFile != "" {
		gopid.CheckPid(args.pidFile, args.force)
		gopid.CreatePid(args.pidFile)
		defer gopid.CleanPid(args.pidFile)
	}

	for _, p := range args.programs {
		z.Add(NewGod(p, args.args))
	}

	// need to handle panic and shut down others
	log.Printf("Number of goroutines %d before start", runtime.NumGoroutine())
	for _, d := range z.gods {
		go d.Start()
	}

	log.Printf("Number of goroutines %d after start", runtime.NumGoroutine())
	sigc := make(chan os.Signal, 1)
	signal.Notify(sigc, os.Kill, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
	for {
		sig := <-sigc<commit_msg>Let's just return instead of exit<commit_after>package god

import (
	"github.com/vanng822/gopid"
	"log"
	"os"
	"os/signal"
	"runtime"
	"syscall"
)

type Goz struct {
	gods []*God
}

func NewGoz() *Goz {
	z := new(Goz)
	z.gods = make([]*God, 0)
	return z
}

func (z *Goz) Add(d *God) {
	z.gods = append(z.gods, d)
}

func (z *Goz) Start() {
	args := Args{}

	if err := args.Parse(os.Args[1:]); err != nil || args.help || len(args.programs) == 0 {
		usage()
		return
	}

	if args.pidFile != "" {
		gopid.CheckPid(args.pidFile, args.force)
		gopid.CreatePid(args.pidFile)
		defer gopid.CleanPid(args.pidFile)
	}

	for _, p := range args.programs {
		z.Add(NewGod(p, args.args))
	}

	// need to handle panic and shut down others
	log.Printf("Number of goroutines %d before start", runtime.NumGoroutine())
	for _, d := range z.gods {
		go d.Start()
	}

	log.Printf("Number of goroutines %d after start", runtime.NumGoroutine())
	sigc := make(chan os.Signal, 1)
	signal.Notify(sigc, os.Kill, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
	for {
		sig := <-sigc
{'fraction_non_alphanumeric': 0.1736641221374046, 'fraction_numerical': 0.00715648854961832, 'mean_word_length': 3.588621444201313, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4236827', 'n_tokens_mistral': 943, 'n_tokens_neox': 899, 'n_words': 206}