<commit_before><?php


$prog_text = $_POST["code"];
$jana_flags = array("-t30");

if (isset($_POST["intsize"]) && $_POST["intsize"] === "32") {
  array_push($jana_flags, "-m");
}

# Read program from stdin
array_push($jana_flags, "-");

$dir = dirname(__FILE__);
$cmd = "$dir/../jana " . implode(" ", $jana_flags);

$cwd = "/tmp";
$descriptorspec = array(
    0 => array("pipe", "r"),
    1 => array("pipe", "w")
);
$env = array();

$process = proc_open($cmd, $descriptorspec, $pipes, $cwd, $env);

if (is_resource($process)) {

    fwrite($pipes[0], $prog_text);
    fclose($pipes[0]);

    echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);

    $return_value = proc_close($process);
    if ($return_value === 124) {
      echo "Execution timed out!\n";
    }

    echo "command returned $return_value\n";
}

?><commit_msg>Output exit code in first line of execute.php output<commit_after><?php


$prog_text = $_POST["code"];
$jana_flags = array("-t30");

if (isset($_POST["intsize"]) && $_POST["intsize"] === "32") {
  array_push($jana_flags, "-m");
}

# Read program from stdin
array_push($jana_flags, "-");

$dir = dirname(__FILE__);
$cmd = "$dir/../jana " . implode(" ", $jana_flags);

$cwd = "/tmp";
$descriptorspec = array(
    0 => array("pipe", "r"),
    1 => array("pipe", "w")
);
$env = array();

$process = proc_open($cmd, $descriptorspec, $pipes, $cwd, $env);

if (is_resource($process)) {

    fwrite($pipes[0], $prog_text);
    fclose($pipes[0]);

    $output = stream_get_contents($pipes[1]);
    fclose($pipes[1]);

    $return_value = proc_close($process);

    echo $return_value . "\n";

    if ($return_value === 124) {
      echo "Execution timed out!\n";
    }
    echo $output;
}

?>
{'fraction_non_alphanumeric': 0.22597553873034362, 'fraction_numerical': 0.015142690739662202, 'mean_word_length': 4.097922848664688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3574147', 'n_tokens_mistral': 670, 'n_tokens_neox': 652, 'n_words': 131}