NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle+80 views

Что произойдёт, если один скрипт читает открытый файл, а другой выполнит `unlink` этого файла?

Practice

AI answer

On Unix-like systems, unlink removes a file's name from the directory but does not close file descriptors that are already open. A process that has already opened the file will generally continue to read it through the descriptor. A new open using the previous path will fail, and the data will be freed on disk after the last descriptor is closed and all references to the inode are removed. The behavior when deleting an open file may differ on Windows: the operation sometimes fails if the file is open without delete permission.