Skip to content

Commit db0fb20

Browse files
Merge pull request docker-library#27 from polyverse/archis/memory-limit
Allow setting transformer memory limit over CLI params
2 parents bea51fb + 8e1dd81 commit db0fb20

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

polyscripting/src/transformer/tok-php-transformer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
include 'snip-transform.php';
7-
const LONG_OPTS = array("replace", "test", "dump", "phar", "inc", "dictionary:");
7+
const LONG_OPTS = array("replace", "test", "dump", "phar", "inc", "dictionary:", "memory_limit::");
88

99
set_error_handler("error_handle", E_USER_ERROR);
1010

@@ -62,6 +62,12 @@ function arg_parse($opts)
6262
{
6363
global $dump, $root_path, $out, $replace, $is_snip, $dictionary_path;
6464

65+
if (array_key_exists("memory_limit", $opts)) {
66+
$memory_limit = $opts["memory_limit"];
67+
echo "Setting memory limit to: " . $memory_limit . "\n";
68+
ini_set('memory_limit', $memory_limit);
69+
}
70+
6571
if (array_key_exists("s", $opts) && array_key_exists("p", $opts)) {
6672
trigger_error("Cannot polyscript both path and snip.", E_USER_ERROR);
6773
}

0 commit comments

Comments
 (0)