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

fix issue :https://github.com/Masterminds/glide/issues/960. #970

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 15 additions & 2 deletions path/winbug.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,23 @@ func CustomRename(o, n string) error {
// Handking windows cases first
if runtime.GOOS == "windows" {
msg.Debug("Detected Windows. Moving files using windows command")
cmd := exec.Command("cmd.exe", "/c", "move", o, n)

// fix issue: https://github.com/Masterminds/glide/issues/960.
// "Unable to export dependencies to vendor directory: Error moving files: exit status 1"
// using XCOPY and RMDIR to replace MOVE
cmd := exec.Command("cmd.exe", "/C","XCOPY", "/Y", "/E", "/I", "/Q", o, n)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("Error moving files: %s. output: %s", err, output)
return fmt.Errorf("Error copying files: %s. output: %s", err, output)
}

cmd = exec.Command("cmd.exe", "/C", "RMDIR", "/S", "/Q", o)
output, err = cmd.CombinedOutput()
if err != nil {
exitCode := getExitCode(err)
if exitCode != winErrorFileNotFound && exitCode != winErrorPathNotFound {
return fmt.Errorf("Error removing files: %s. output: %s", err, output)
}
}

return nil
Expand Down