Skip to content
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

vpm: init_settings: mkdir_all before set_output_path #21463

Merged
merged 1 commit into from
May 8, 2024

Conversation

smalltalkman
Copy link
Contributor

os.open_append called by logger.set_output_path calls C._wfopen(wpath, mode.to_wide()) with mode := 'ab'. When the folder $VMODULES\cache does not exist, C._wfopen(wpath, mode.to_wide()) returns NULL and causes an error.

This PR aims to avoid 'V panic: error while opening log file $VMODULES\cache\vpm.log for appending' error.

Before modification:

# echo $VMODULES
/d/gym/test/mingw-w64-packages/mingw-w64-v/vmodules/mingw-w64-i686-v-weekly.2024.19-1

# ll $VMODULES
ls: cannot access '/d/gym/test/mingw-w64-packages/mingw-w64-v/vmodules/mingw-w64-i686-v-weekly.2024.19-1': No such file or directory

# ./v run cmd/tools/vpm/install_test.v
V panic: error while opening log file D:\gym\test\mingw-w64-packages\mingw-w64-v\vmodules\mingw-w64-i686-v-weekly.2024.19-1\cache\vpm.log for appending
v hash: d6d0f9b
print_backtrace_skipping_top_frames is not implemented

Signed-off-by: Yuanmiao Gui <gui_yuan_miao@163.com>
@spytheman spytheman merged commit 2e9b4cf into vlang:master May 8, 2024
25 checks passed
@spytheman
Copy link
Member

Excellent.

@smalltalkman smalltalkman deleted the fix-init_settings branch May 10, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants