Skip to content

Commit 992e066

Browse files
committed
chore: remove draft post about validation
1 parent 45c8d23 commit 992e066

File tree

2 files changed

+22
-70
lines changed

2 files changed

+22
-70
lines changed

_drafts/2025-07-12-seek-validation-en.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

scripts/create/publish.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def publish_drafts_to_posts():
1111
today = datetime.date.today()
1212
date_str = today.strftime('%Y-%m-%d')
1313

14-
drafts_dir = "_drafts"
14+
drafts_dir = '_drafts'
1515
posts_en_dir = os.path.join('_posts', 'en')
1616

1717
if not os.path.exists(drafts_dir):
@@ -40,25 +40,30 @@ def publish_drafts_to_posts():
4040
except Exception as e:
4141
print(f"Error moving '{file_name}': {e}")
4242

43-
# Restart VSCode to close open tabs and prevent accidental editing of moved files
4443
restart_vscode()
4544

4645
def restart_vscode():
47-
print("Restarting VSCode to prevent accidental re-creation of draft files...")
48-
if sys.platform == 'win32':
49-
os.system('taskkill /f /im Code.exe /t')
50-
time.sleep(2)
51-
subprocess.Popen(['code', '.'])
52-
elif sys.platform == 'darwin':
53-
os.system("pkill -f 'Visual Studio Code'")
54-
time.sleep(2)
55-
subprocess.call(['open', '-a', 'Visual Studio Code', '.'])
56-
elif sys.platform.startswith('linux'):
57-
os.system('killall code')
58-
time.sleep(2)
59-
subprocess.Popen(['code', '.'])
60-
else:
61-
print("Unsupported platform for restarting VSCode.")
46+
print("Restarting VSCode gracefully to prevent accidental re-creation of draft files...")
47+
try:
48+
if sys.platform == 'win32':
49+
# Graceful close without /f
50+
os.system('taskkill /im Code.exe /t')
51+
time.sleep(3) # Delay for cleanup
52+
subprocess.Popen(['code', '.']) # Reopen
53+
elif sys.platform == 'darwin':
54+
# Use AppleScript for graceful quit
55+
os.system('osascript -e \'quit app "Visual Studio Code"\'')
56+
time.sleep(3)
57+
subprocess.call(['open', '-a', 'Visual Studio Code', '.'])
58+
elif sys.platform.startswith('linux'):
59+
# SIGTERM for graceful termination
60+
os.system('killall code')
61+
time.sleep(3)
62+
subprocess.Popen(['code', '.'])
63+
else:
64+
print("Unsupported platform for restarting VSCode.")
65+
except Exception as e:
66+
print(f"Error during restart: {e}. Please manually restart VSCode.")
6267

6368
if __name__ == "__main__":
6469
publish_drafts_to_posts()

0 commit comments

Comments
 (0)