<commit_before>package main

import (
	"log"
	"net/url"
	"os"
	"os/exec"
	"syscall"
)

func execPlugin(path string, args []string) error {
	u, err := url.Parse(apiURL)
	if err != nil {
		log.Fatal(err)
	}

	hkuser, hkpass := getCreds(u)
	hkapp, _ := app()
	env := []string{
		"HEROKU_API_URL="+apiURL,
		"HKAPP=" + hkapp,
		"HKUSER=" + hkuser,
		"HKPASS=" + hkpass,
		"HKHOST=" + u.Host,
		"HKVERSION=" + Version,
	}

	return syscall.Exec(path, args, append(env, os.Environ()...))
}

func findPlugin(name string) (path string) {
	path = lookupPlugin(name)
	if path == "" {
		path = lookupPlugin("default")
	}
	return path
}

// NOTE: lookupPlugin is not threadsafe for anything needing the PATH env var.
func lookupPlugin(name string) string {
	const defaultPluginPath = "/usr/local/lib/hk/plugin"

	opath := os.Getenv("PATH")
	defer os.Setenv("PATH", opath)

	os.Setenv("PATH", os.Getenv("HKPATH")+":"+defaultPluginPath)
	path, err := exec.LookPath(name)
	if err != nil {
		if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
			return ""
		}
		log.Fatal(err)
	}
	return path
}<commit_msg>do not append to HKPATH if set<commit_after>package main

import (
	"log"
	"net/url"
	"os"
	"os/exec"
	"syscall"
)

func execPlugin(path string, args []string) error {
	u, err := url.Parse(apiURL)
	if err != nil {
		log.Fatal(err)
	}

	hkuser, hkpass := getCreds(u)
	hkapp, _ := app()
	env := []string{
		"HEROKU_API_URL="+apiURL,
		"HKAPP=" + hkapp,
		"HKUSER=" + hkuser,
		"HKPASS=" + hkpass,
		"HKHOST=" + u.Host,
		"HKVERSION=" + Version,
	}

	return syscall.Exec(path, args, append(env, os.Environ()...))
}

func findPlugin(name string) (path string) {
	path = lookupPlugin(name)
	if path == "" {
		path = lookupPlugin("default")
	}
	return path
}

// NOTE: lookupPlugin is not threadsafe for anything needing the PATH env var.
func lookupPlugin(name string) string {
	const defaultPluginPath = "/usr/local/lib/hk/plugin"
	hkpath := os.Getenv("HKPATH")
	if hkpath == "" {
		hkpath = defaultPluginPath
	}

	opath := os.Getenv("PATH")
	defer os.Setenv("PATH", opath)
	os.Setenv("PATH", hkpath)

	path, err := exec.LookPath(name)
	if err != nil {
		if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
			return ""
		}
		log.Fatal(err)
	}
	return path
}
{'fraction_non_alphanumeric': 0.173568281938326, 'fraction_numerical': 0.0, 'mean_word_length': 3.7710084033613445, 'pattern_counts': {'":': 1, '<': 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': '3124824', 'n_tokens_mistral': 956, 'n_tokens_neox': 888, 'n_words': 212}