[Mono-list] Opening /dev/null using FileStream

Robert Jordan robertj at gmx.net
Fri May 7 12:46:12 EDT 2010


On 07.05.2010 17:24, muhr wrote:
>
> Hello Alan
>
>
> Alan McGovern wrote:
>>
>> Could you not just use Stream.Null?
>>
>
> The point is that the string is not fixed to "/dev/null" in the real
> application. It could also name a regular file. It's just that if I'm not
> interested in this information, I would like to specify "/dev/null".
>
> Of course, the easy hack would be to check the filename for "/dev/null" and
> then programmatically switch between FileStream or Stream.Null. But this
> problem made me curious whether it is a problem with Mono or whether I'm
> just using it wrong.

It's a problem with Mono's shared handles. You can disable them with

MONO_DISABLE_SHM=1 mono yourapp.exe

Upcoming Mono versions will disable them by default anyways.

Robert



More information about the Mono-list mailing list