Skip to content

Conversation

W1M0R
Copy link
Contributor

@W1M0R W1M0R commented Jul 31, 2025

Check List

This PR fixes #4046. The aqua cp command (without arguments) copies the executables for all packages to a specific location, however, it failed to add the .exe extension for those executables on Windows. It now correctly adds the missing .exe extension.

The fix follows the convention established by the aqua cp <package> command:

func (c *Controller) copy(logE *logrus.Entry, param *config.Param, exePath string, exeName string) error {
p := filepath.Join(param.Dest, exeName)
if c.runtime.GOOS == "windows" && filepath.Ext(exeName) == "" {
p += ".exe"
}
logE.WithFields(logrus.Fields{
"exe_name": exeName,
"dest": p,
}).Info("coping a file")
if err := c.packageInstaller.Copy(p, exePath); err != nil {
return fmt.Errorf("copy a file: %w", err)
}
return nil
}

@W1M0R W1M0R marked this pull request as ready for review July 31, 2025 14:10
@W1M0R
Copy link
Contributor Author

W1M0R commented Jul 31, 2025

@suzuki-shunsuke Thanks for a great project! I built and tested this locally on Windows, and confirmed that the copied executables now contain the .exe extension, and that they execute the correct programs. I tried to follow the guidance in the CONTRIBUTING document. Please let me know if I missed anything.

for exeName := range exeNames {
if err := is.Copy(filepath.Join(is.copyDir, exeName), exePath); err != nil {
p := filepath.Join(is.copyDir, exeName)
if is.runtime.GOOS == "windows" && filepath.Ext(exeName) == "" {
Copy link
Member

@suzuki-shunsuke suzuki-shunsuke Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if is.runtime.GOOS == "windows" && filepath.Ext(exeName) == "" {
if is.runtime.IsWindows() && filepath.Ext(exeName) == "" {

@suzuki-shunsuke
Copy link
Member

Thank you for your contribution!

@suzuki-shunsuke suzuki-shunsuke added bug Something isn't working command:cp labels Jul 31, 2025
@suzuki-shunsuke suzuki-shunsuke added this to the v2.53.8 milestone Jul 31, 2025
@suzuki-shunsuke suzuki-shunsuke merged commit 2276d8a into aquaproj:main Jul 31, 2025
18 checks passed
@github-project-automation github-project-automation bot moved this to Done in main Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working command:cp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aqua cp on windows
2 participants