<commit_before>package main

import (
	"apibox.club/utils"
	"apibox.club/website"
	"bytes"
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
	"syscall"
	"time"
)

const (
	START  string = "start"
	STOP   string = "stop"
	STATUS string = "status"
)

type Apibox struct {
	PID int
}

func (a *Apibox) GetPID() (*Apibox, error) {
	b, err := ioutil.ReadFile(apibox.PidPath)
	if nil != err {
		return nil, err
	}
	b = bytes.TrimSpace(b)
	pid, err := apibox.StringUtils(string(b)).Int()
	if nil != err {
		return nil, err
	}
	a.PID = pid
	return a, nil
}

func (a *Apibox) Start() error {
	time.Sleep(time.Duration(1 * time.Second))
	if apibox.Exists(apibox.PidPath) {
		_, err := a.GetPID()
		if nil != err {
			return err
		}
		if err := syscall.Kill(a.PID, 0); nil != err {
			apibox.Set_log_level(apibox.LevelDebug)
			website.Run()
		} else {
			fmt.Fprintf(os.Stderr, "The program is running, turn off the start again.\n")
		}
	} else {
		website.Run()
	}
	return nil
}

func (a *Apibox) Stop() error {
	time.Sleep(time.Duration(1 * time.Second))
	if apibox.Exists(apibox.PidPath) {
		_, err := a.GetPID()
		if nil != err {
			return err<commit_msg>Fix Bugs : PID Nil<commit_after>package main

import (
	"bytes"
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
	"syscall"
	"time"

	"apibox.club/utils"
	"apibox.club/website"
)

const (
	START  string = "start"
	STOP   string = "stop"
	STATUS string = "status"
)

type Apibox struct {
	PID int
}

func (a *Apibox) GetPID() (*Apibox, error) {
	b, err := ioutil.ReadFile(apibox.PidPath)
	if nil != err {
		return nil, err
	}
	b = bytes.TrimSpace(b)
	pid, err := apibox.StringUtils(string(b)).Int()
	if nil != err {
		return nil, err
	}
	a.PID = pid
	return a, nil
}

func (a *Apibox) Start() error {
	website.Run()
	return nil
}

func (a *Apibox) Stop() error {
	time.Sleep(time.Duration(1 * time.Second))
	if apibox.Exists(apibox.PidPath) {
		_, err := a.GetPID()
		if nil != err {
			return err
{'fraction_non_alphanumeric': 0.16115702479338842, 'fraction_numerical': 0.002066115702479339, 'mean_word_length': 3.29490022172949, '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': '7637824', 'n_tokens_mistral': 892, 'n_tokens_neox': 834, 'n_words': 199}