My application basically does a
It does not have any knowledge about what program $someProg is (i.e. the programs to be executed here are not written by me). The app is supposed to run unattended. It is no problem if $someProg takes arbitrarily long to execute, but the following is: If the program happens to loop forever, AND inside the loop writes something to stdout, it simply fills up the disk.IPC::Run::run([$someProg,...],'>output.txt');
It is OK to limit the size of the output file. For instance, under Unix I would do a ulimit -f before invoking my Perl program, but we are on Windows.
Is there a way to limit the size of a file created, so that Windows would abort a process if it creates a file larger than the limit? Otherwise, is there another possibility to inhibit large files to be created?
I already had the idea to use a pipe,
where guarded_tee.pl would work like a usual 'tee', but would close the pipe after it received more than a certain number of bytes. But aside from that not being a very elegant solution, I don't have enough knowledge about the internals of the Windows piping system, and of the hidden traps which might be lurking. So maybe someone could either point out a different solution, or verify that my 'tee' solution should work without risks in every circumstance..... '|perl guarded_tee.pl output.txt'
In reply to Windows-specific: Limiting output of created files by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |