<commit_before>package daemon

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

type Daemon interface {
	Stop()
}

func Main(start func(args []string, errorSink ErrorSink) Daemon) {
	sigs := make(chan os.Signal, 2)
	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)

	errorSink := NewErrorSink()

	d := start(os.Args, errorSink)
	exitCode := 0
	var exitSignal os.Signal

	select {
	case err := <-errorSink:
		if err != flag.ErrHelp {
			fmt.Fprintln(os.Stderr, err)
			exitCode = 1
		}
	case exitSignal = <-sigs:
	}

	d.Stop()

	if sig, ok := exitSignal.(syscall.Signal); ok {<commit_msg>All your cpu are belong to us<commit_after>package daemon

import (
	"flag"
	"fmt"
	"os"
	"os/signal"
	"runtime"
	"syscall"
)

type Daemon interface {
	Stop()
}

func Main(start func(args []string, errorSink ErrorSink) Daemon) {
	runtime.GOMAXPROCS(runtime.NumCPU())

	sigs := make(chan os.Signal, 2)
	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)

	errorSink := NewErrorSink()

	d := start(os.Args, errorSink)
	exitCode := 0
	var exitSignal os.Signal

	select {
	case err := <-errorSink:
		if err != flag.ErrHelp {
			fmt.Fprintln(os.Stderr, err)
			exitCode = 1
		}
	case exitSignal = <-sigs:
	}

	d.Stop()

	if sig, ok := exitSignal.(syscall.Signal); ok {
{'fraction_non_alphanumeric': 0.14556962025316456, 'fraction_numerical': 0.004746835443037975, 'mean_word_length': 3.7916666666666665, 'pattern_counts': {'":': 0, '<': 7, '<?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': '319697', 'n_tokens_mistral': 533, 'n_tokens_neox': 496, 'n_words': 120}