My process may get started with or without console. In the latter case, any write leads to "Disk full" on MacOS. As I can't eliminate all writes, I'd need to open both stdout and stderr as /dev/null.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20181023/6b53e1f1/attachment.html>
Mailing lists / lazarus / 2018-10
Use /dev/null for stdout
4 messages · 4 people · –
- AAmir 1
- Lleledumbo 1
- MMartin Frb 1
- MMartin Grajcar 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
In Linux, I redirect stdin from a file (and/or stdout to a file) by putting "< input.txt" ("> output.txt", respectively) in Run Parameters -> Command Line parameters.
I believe that should work for MacOS...
Martin Grajcar wrote 5 lines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20181023/804375b3/attachment.html>
My process may get started with or without console. In the latter case, any write leads…
Martin Grajcar wroteMy process may get started with or without console. In the latter case, any write leads to "Disk full" on MacOS. As I can't eliminate all writes, I'd need to open both stdout and stderr as /dev/null.
Have a look at logger frameworks.
LazLogger is included: http://wiki.lazarus.freepascal.org/LazLogger Use "debugln" instead of "writeln". debugln will test if stdout is open or not.
There are still cases where stdout can return a "disk full", those are (in the latest version) caught and ignored.
My process may get started with or without console. In the latter case, any write leads…
I'd need to open both stdout and stderr as /dev/null.
Both are represented as System.Text (or ObjPas.TextFile) named System.Output and System.StdErr respectively (There are also System.StdOut and System.ErrOutput as their alias, but it looks like they're not proper alias but rather different instances pointing to the same file), you can System.Close, Re-System.Assign to '/dev/null' at runtime (start of your program, maybe?) then Re-Rewrite them. From that point onwards, every call to Write[Ln](...) will write to /dev/null.
