From 4f1ed70c96d48fdc2ff5df5b65ecd277c65728c8 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 12 Apr 2026 01:11:59 +0800 Subject: [PATCH] Move out callback --- src/StaticPHP/Command/ResetCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StaticPHP/Command/ResetCommand.php b/src/StaticPHP/Command/ResetCommand.php index 207f6484..85928c2f 100644 --- a/src/StaticPHP/Command/ResetCommand.php +++ b/src/StaticPHP/Command/ResetCommand.php @@ -62,8 +62,10 @@ class ResetCommand extends BaseCommand InteractiveTerm::indicateProgress("Removing: {$path}"); if (PHP_OS_FAMILY === 'Windows') { + Shell::passthruCallback(fn () => InteractiveTerm::advance()); // Force delete on Windows to handle git directories $this->removeDirectoryWindows($path); + Shell::passthruCallback(null); } else { // Use FileSystem::removeDir for Unix systems FileSystem::removeDir($path); @@ -88,7 +90,6 @@ class ResetCommand extends BaseCommand // Try using PowerShell for force deletion $escaped_path = escapeshellarg($path); - Shell::passthruCallback(fn () => InteractiveTerm::advance()); // Use PowerShell Remove-Item with -Force and -Recurse $result = cmd()->execWithResult("powershell -Command \"Remove-Item -Path {$escaped_path} -Recurse -Force -ErrorAction SilentlyContinue\"", false); @@ -106,6 +107,5 @@ class ResetCommand extends BaseCommand if (is_dir($path)) { FileSystem::removeDir($path); } - Shell::passthruCallback(null); } }