Skip to content

Conversation

@c84c
Copy link

@c84c c84c commented May 17, 2022

Implements

Fix #121

Discussion

During refactoring on commit change plugin build mechanism the new flogo executable is created instead of renamed.

Linux system not allows to update a running executable resulting in error text file busy.

The PR insert a SwapFile function to allow replacement of running executable (Thanks to @fenollp and his gist)

Code references

Old renaming implementation on commits before change plugin build mechanism :

err = os.Rename(filepath.Join(cliCmdPath, cliExe), exe)

Actual implementation on master:
Executable copy:

err = util.Copy(filepath.Join(cliCmdPath, cliExe), exPath, false)

copyFile function

cli/util/file.go

Lines 131 to 143 in 5c3e1e3

var df *os.File
if df, err = os.Create(dst); err != nil {
return err
}
defer df.Close()
if err = os.Chmod(sf.Name(), srcInfo.Mode()); err != nil {
return err
}
if _, err = io.Copy(df, sf); err != nil {
return err
}

@mellistibco mellistibco requested a review from vijaynalawade May 17, 2022 14:33
@c84c
Copy link
Author

c84c commented Jul 8, 2022

Have you planned when to merge the Pull Request?

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.

Fail to install any CLI plugin

3 participants