Skip to content

Commit 0ce8a2f

Browse files
committed
Prevent bad things when using a custom logs folder
1 parent 99d422d commit 0ce8a2f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

seleniumbase/core/log_helper.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ def log_folder_setup(log_path, archive_logs=False):
126126
# have "-c" in the sys.argv list. Easy to catch.)
127127
archived_logs = "%slogs_%s" % (
128128
archived_folder, int(time.time()))
129+
if "_logs" not in log_path:
130+
# Don't move files in a custom-named log folder (in case
131+
# the user specifed a folder with important files in it)
132+
# unless the folder name contains "_logs".
133+
# The default name for the log folder is "latest_logs".
134+
return
129135
shutil.move(log_path, archived_logs)
130136
os.makedirs(log_path)
131137
if not settings.ARCHIVE_EXISTING_LOGS and not archive_logs:

0 commit comments

Comments
 (0)