How do I set a ulimit from inside a Perl script that applies to its children?

后端 未结 4 2027
花落未央
花落未央 2021-01-02 16:00

I have a Perl script that does various installation steps to set up a development box for our company. It runs various shell scripts, some of which crash due to lower than r

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 16:12

    You've already answered your question: use BSD::Resource.

    There isn't anything in the Perl core that interfaces with setrlimit. If you can't (or won't) use the standard method, then you have to use a hack. Any of the methods you've already described would work. (Note that you could create a subroutine to prepend ulimit -s BLA; to every command, and then use that sub instead of system.)

提交回复
热议问题