<commit_before>package container

import (
	"bytes"
	"errors"
	"log"
	"os"
	"strings"

	"h12.me/realtest/util"
)

func (c Container) ip() (string, error) {
	out := util.Command("docker-machine", "ip", "default").Output()
	return string(bytes.TrimSpace(out)), nil
}

func initDocker() error {
	if !(util.CmdExists("docker-machine") && util.CmdExists("docker")) {
		return errors.New("docker not installed")
	}
	if status := string(util.Command("docker-machine", "status", "default").Output()); status != "Running" {
		log.Println("docker-machine start ...")
		if err := util.Command("docker-machine", "start").Run(); err != nil {
			return err
		}
	}
	if os.Getenv("DOCKER_HOST") == "" || os.Getenv("DOCKER_CERT_PATH") == "" || os.Getenv("DOCKER_TLS_VERIFY") == "" {
		os.Setenv("SHELL", "/bin/bash")
		envSettings := strings.Split(string(util.Command("docker-machine", "env", "default").Output()), "\n")
		for _, line := range envSettings {
			line = strings.TrimSpace(line)
			if line == "" {
				continue
			}
			line = strings.TrimPrefix(line, "export ")
			keyVal := strings.Split(line, "=")
			os.Setenv(keyVal[0], keyVal[1])
		}
	}
	return nil
}<commit_msg>fix a bug when start docker<commit_after>package container

import (
	"bytes"
	"errors"
	"log"
	"os"
	"strings"

	"h12.me/realtest/util"
)

func (c Container) ip() (string, error) {
	out := util.Command("docker-machine", "ip", "default").Output()
	return string(bytes.TrimSpace(out)), nil
}

func initDocker() error {
	if !(util.CmdExists("docker-machine") && util.CmdExists("docker")) {
		return errors.New("docker not installed")
	}
	if status := string(util.Command("docker-machine", "status", "default").Output()); status != "Running" {
		log.Println("docker-machine start ...")
		if err := util.Command("docker-machine", "start", "default").Run(); err != nil {
			return err
		}
	}
	if os.Getenv("DOCKER_HOST") == "" || os.Getenv("DOCKER_CERT_PATH") == "" || os.Getenv("DOCKER_TLS_VERIFY") == "" {
		os.Setenv("SHELL", "/bin/bash")
		envSettings := strings.Split(string(util.Command("docker-machine", "env", "default").Output()), "\n")
		for _, line := range envSettings {
			line = strings.TrimSpace(line)
			if line == "" {
				continue
			}
			line = strings.TrimPrefix(line, "export ")
			keyVal := strings.Split(line, "=")
			os.Setenv(keyVal[0], keyVal[1])
		}
	}
	return nil
}
{'fraction_non_alphanumeric': 0.2062951935346661, 'fraction_numerical': 0.0034028073160357296, 'mean_word_length': 4.333333333333333, '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': '3680765', 'n_tokens_mistral': 912, 'n_tokens_neox': 831, 'n_words': 162}