<commit_before>#!/usr/bin/env perl6

use v6;
use lib "../";

use Getopt::Kinoko;

my $is-win32 = $*DISTRO ~~ /mswin32/;

class RunCompiler {
	has Getopt 		$.getopt;
	has OptionSet $!optset;
	has $.current;
	has @!incode;
	has $!out-file;
	has $!target;
	has $!cmd;

	method run {
		$!optset := $!getopt{$!current};
		@!incode  = DeepClone.deep-clone($!optset<e>);

		help($!getopt) if $!optset<h>;

		self.prepare-code();

		help($!getopt) if +@!incode < 1;

		self.print-code if $!optset<p>.elems > 1;

		self.generate-file;

		self.generate-cmd;

		self.run-compiler;

		if $!optset<S> || $!optset<E> {
			self.cat-target;
		}
		else {
			self.run-target;
		}

		self.clean;
	}

	method run-compiler {
		self.run-cmd($!cmd);
	}

	method run-target {
		self.run-cmd("chmod +x " ~ $!target) unless $is-win32;
		self.run-cmd(($is-win32 ?? 'start ' !! '') ~ $!target);
	}

	method cat-target {
		say "$!target".IO.slurp;
	}


	method run-cmd($cmd) {
		try {
			my $out = QX($cmd); # change shell to QX

			print $out if $out.chomp.chars >= 1;
			CATCH {
				default {
					self.clean;
					...
				}
			}
		}
	}

	method clean {
		unlink $!out-file unless $!optset<t>;
		unlink $!target;
	}<commit_msg>elffile must exists when execute<commit_after>#!/usr/bin/env perl6

use v6;
use lib "../";

use Getopt::Kinoko;

my $is-win32 = $*DISTRO ~~ /mswin32/;

class RunCompiler {
	has Getopt 		$.getopt;
	has OptionSet $!optset;
	has $.current;
	has @!incode;
	has $!out-file;
	has $!target;
	has $!cmd;

	method run {
		$!optset := $!getopt{$!current};
		@!incode  = DeepClone.deep-clone($!optset<e>);

		help($!getopt) if $!optset<h>;

		self.prepare-code();

		help($!getopt) if +@!incode < 1;

		self.print-code if $!optset<p>.elems > 1;

		self.generate-file;

		self.generate-cmd;

		self.run-compiler;

		if $!target.IO ~~ :e {
			if $!optset<S> || $!optset<E> {
				self.cat-target;
			}
			else {
				self.run-target;
			}
		}

		self.clean;
	}

	method run-compiler {
		self.run-cmd($!cmd);
	}

	method run-target {
		self.run-cmd("chmod +x " ~ $!target) unless $is-win32;
		self.run-cmd(($is-win32 ?? 'start ' !! '') ~ $!target);
	}

	method cat-target {
		say "$!target".IO.slurp;
	}


	method run-cmd($cmd) {
		try {
			my $out = QX($cmd); # change shell to QX

			print $out if $out.chomp.chars >= 1;

			return True;
			CATCH {
				default {
					self.clean;
					...
				}
			}
		}
	}

	method clean {
		unlink $!out-file unless $!optset<t>;
		unlink $!target;
	}
{'fraction_non_alphanumeric': 0.19708619991906112, 'fraction_numerical': 0.010522055847834885, 'mean_word_length': 2.7454545454545456, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '575519', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1062, 'n_words': 211}