<commit_before>// Copyright (c) 2016 <NAME>
// This file is licensed under the MIT license.
// See the LICENSE file for more information.

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"
	"os/signal"

	"github.com/nwolber/xCUTEr/job"

	_ "net/http/pprof"
)

func main() {
	// jobDir, sshTTL, file, logFile, perf, once, quiet := config()
	_, sshTTL, file, _, perf, _, _ := config()

	if perf != "" {
		go func() {
			log.Println(http.ListenAndServe(perf, nil))
		}()
	}

	signals := make(chan os.Signal, 1)
	signal.Notify(signals, os.Interrupt, os.Kill)

	// x, err := xCUTEr.New(jobDir, sshTTL, file, logFile, once, quiet)
	// if err != nil {
	// 	log.Fatalln(err)
	// }
	// x.Start()
	job.InitializeSSHClientStore(sshTTL)

	c, _ := job.ReadConfig(file)
	info, _ := job.Instrument(c)

	f, updates := info.GetFlunc()

	go f(context.WithValue(context.Background(), "output", os.Stdout))

	tree := ""
loop:
	for {
		select {
		// case <-x.Done:
		case text, ok := <-updates:
			if !ok {
				break loop
			}

			// fmt.Println(text)
			tree = text
		case s := <-signals:
			fmt.Println("Got signal:", s)
			// x.Stop()
			// x.Cancel()
			break loop
		}
	}
	log.Println("fin")

	fmt.Println(tree)<commit_msg>Restore xCUTEr/main.go<commit_after>// Copyright (c) 2016 <NAME>
// This file is licensed under the MIT license.
// See the LICENSE file for more information.

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"os/signal"

	_ "net/http/pprof"

	"github.com/nwolber/xCUTEr"
)

func main() {
	jobDir, sshTTL, file, logFile, perf, once, quiet := config()

	if perf != "" {
		go func() {
			log.Println(http.ListenAndServe(perf, nil))
		}()
	}

	signals := make(chan os.Signal, 1)
	signal.Notify(signals, os.Interrupt, os.Kill)

	x, err := xCUTEr.New(jobDir, sshTTL, file, logFile, once, quiet)
	if err != nil {
		log.Fatalln(err)
	}
	x.Start()

	select {
	case <-x.Done:
	case s := <-signals:
		fmt.Println("Got signal:", s)
		x.Stop()
		x.Cancel()
	}

	log.Println("fin")
{'fraction_non_alphanumeric': 0.17926890335503254, 'fraction_numerical': 0.005007511266900351, 'mean_word_length': 3.0775510204081633, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, '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': '2595772', 'n_tokens_mistral': 895, 'n_tokens_neox': 813, 'n_words': 190}