Unlinked temporary files

72 views
Skip to first unread message

drakk...@gmail.com

unread,
Jan 3, 2020, 12:50:20 PM1/3/20
to golang-nuts
Hi,

I'm going to use this library https://github.com/eikenb/pipeat/ 

it reads/writes from/to an unlinked temporary file, as you can see here:


the temporary file is removed and then used for I/O operations. 

I ran the test cases on Windows and they work there too.

Is it really safe to assume that an unliked file will work on all supported OS? I was really surprised that this work on Windows,

Thanks!

Egon

unread,
Jan 7, 2020, 6:45:47 AM1/7/20
to golang-nuts
You are not checking return value of os.Remove in https://github.com/eikenb/pipeat/blob/master/pipeat.go#L51.
That will fail on windows.

You can take look at https://github.com/calebcase/tmpfile, which works on Windows.

+ Egon
Reply all
Reply to author
Forward
0 new messages