Does the file descriptor returned by fs.open need to be explictly closed or will it close itself once fd
goes out of scope?
Asked
Active
Viewed 47 times
0

mpen
- 272,448
- 266
- 850
- 1,236
-
Possible duplicate of [What the scenario call fs.close is necessary](http://stackoverflow.com/questions/21176733/what-the-scenario-call-fs-close-is-necessary) – Mike 'Pomax' Kamermans Oct 24 '16 at 18:48
-
@Mike'Pomax'Kamermans That doesn't answer what happens if `fd` goes out of scope. – mpen Oct 24 '16 at 18:54
-
1I'm reading "But if you call fs.open or any of the others that give a fd, you must eventually fs.close the fd that you are given." as "you are on the hook for getting `close` called". If `fd` goes out of scope, you now have a file handle that can't be closed properly ever again. – Mike 'Pomax' Kamermans Oct 24 '16 at 19:08