Skip to content

fix[Windows]: Close log writer before removing files to avoid deletion issue (#631) #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lox-fr
Copy link

@Lox-fr Lox-fr commented Jul 21, 2025

What does this PR do ?

It ensures the log file is properly closed (via logWriter.Close()) when stopping a process on Windows, avoiding file lock issues.

###Why is it needed?
On Windows, when running symfony serve -d, the .log file stays locked after symfony server:stop, preventing cleanup and deletion.

How to reproduce the issue

  • Run symfony serve -d
  • Try to remove the .log file manually ➜ Windows error: "file is in use"
  • Stop the server ➜ file still locked

How this fix works

  • Calls logWriter.Close() during cleanup
  • Ensures proper Remove() calls are effective (both .pid and .log)

OS affected

✅ Windows only
🚫 Linux/macOS not affected

…log on shutdown

On Windows, deleting an open log file fails because it's still held by the process.
This commit updates PidFile.Remove() to explicitly close the log writer if open

Fixes symfony-cli#631
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant