<commit_before>package main

import (
	"os"

	"github.com/lxc/lxd"
)

type execCmd struct{}

const execUsage = `
exec specified command in a container.

lxc exec container [command]
`

func (c *execCmd) usage() string {
	return execUsage
}

func (c *execCmd) flags() {}

func (c *execCmd) run(config *lxd.Config, args []string) error {
	if len(args) < 2 {
		return errArgs
	}

	d, name, err := lxd.NewClient(config, args[0])
	if err != nil {
		return err
	}

	return d.Exec(name, args[1:], os.Stdin, os.Stdout, os.Stderr)
}<commit_msg>Emulate a terminal slightly more accurately<commit_after>package main

import (
	"os"
	"syscall"

	"github.com/lxc/lxd"
	"golang.org/x/crypto/ssh/terminal"
)

type execCmd struct{}

const execUsage = `
exec specified command in a container.

lxc exec container [command]
`

func (c *execCmd) usage() string {
	return execUsage
}

func (c *execCmd) flags() {}

func (c *execCmd) run(config *lxd.Config, args []string) error {
	if len(args) < 2 {
		return errArgs
	}

	d, name, err := lxd.NewClient(config, args[0])
	if err != nil {
		return err
	}

	cfd := syscall.Stdout
	if terminal.IsTerminal(cfd) {
		oldttystate, err := terminal.MakeRaw(cfd)
		if err != nil {
			return err
		}
		defer terminal.Restore(cfd, oldttystate)
	}

	return d.Exec(name, args[1:], os.Stdin, os.Stdout, os.Stderr)
}
{'fraction_non_alphanumeric': 0.1408132530120482, 'fraction_numerical': 0.004518072289156626, 'mean_word_length': 3.8503649635036497, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4385158', 'n_tokens_mistral': 538, 'n_tokens_neox': 507, 'n_words': 142}