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

tools.vpm: fix windows install of already existing module #19761

Merged
merged 2 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cmd/tools/vpm/install.v
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,18 @@ fn vpm_install_from_vcs(modules []string, vcs &VCS) {
if os.exists(minfo.final_module_path) {
eprintln('Warning module "${minfo.final_module_path}" already exists!')
eprintln('Removing module "${minfo.final_module_path}" ...')
os.rmdir_all(minfo.final_module_path) or {
mut err_msg := ''
$if windows {
os.execute_opt('rd /s /q ${minfo.final_module_path}') or {
err_msg = err.msg()
}
} $else {
os.rmdir_all(minfo.final_module_path) or { err_msg = err.msg() }
}
if err_msg != '' {
errors++
eprintln('Errors while removing "${minfo.final_module_path}" :')
eprintln(err)
eprintln(err_msg)
continue
}
}
Expand Down
5 changes: 0 additions & 5 deletions cmd/tools/vpm/install_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ fn test_install_from_git_url() {
}

fn test_install_already_existent() {
// FIXME: Skip this for now on Windows, as `rmdir_all` results in permission
// errors when vpm tries to remove existing modules.
$if windows {
return
}
mut res := os.execute('${v} install https://github.com/vlang/markdown')
assert res.exit_code == 0, res.output
assert res.output.contains('already exists')
Expand Down
Loading