How do I close the standard output and standard error on Erlang?

Viewed 53

I have tried several things such as file:close(standard_io), file:close(standard_error) and {ok, Fd} = file:open(standard_io, []). 1 to no avail.


The effects of this are the following (in python for illustration):

python3 | sed -E 's/a/b/g'
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('a')
>>> b
import sys
sys.stderr.close()
sys.stdout.close()
>>> >>> >>>
>>> print('a')
>>>
>>> exit()

Notice that >>> b was actually output by sed and once the stdout was closed no more data flowed through it.

0 Answers
Related