Macaulay2 » Documentation
Packages » RunExternalM2 :: PreRunScript
next | previous | forward | backward | up | index | toc

# PreRunScript -- a way to impose resource limits

## Description

This option's value is a string containing a shell command that can impose any resource limits on the Macaulay2 process started by runExternalM2.

By default, it is set to the shell command

    true

but you can set it to things like

    ulimit -t 5

(to limit CPU time to 5 seconds) or something more complicated:

    ulimit -S -m 654243 && ulimit -H -t 50

In all cases, it should be a single command such that appending

    && other_command

results in a valid shell command.

## See also

- RunExternalM2 -- a package to run Macaulay2 code externally and retrieve the result
- runExternalM2 -- run a Macaulay2 function in a new Macaulay2 process
- resource limits -- how to use resource limits with Macaulay2

## Functions with optional argument named PreRunScript:

- `runExternalM2(...,PreRunScript=>...)`

## For the programmer

The object PreRunScript is a symbol.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/RunExternalM2.m2:894:0.