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(terminal): failure to remove .lock file #233

Merged
merged 1 commit into from
May 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion lua/cmake-tools/terminal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ end
local get_command_handling_on_exit = function()
return "echo $? > "
.. get_last_exit_code_file_path() -- write exitcode to file
.. " && rm "
.. " && \\rm -f "
Copy link
Owner

Choose a reason for hiding this comment

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

Why is there a \\?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the shortest way to bypass an alias in the shell.

There are multiple ways to do this (with pros and cons):

  • prefix a back slash to disable the alias: \rm -f
  • use "command": command rm -f (will also cover the case when the user has a custom function called rm() but some shells might not support it)
  • use the full path: /bin/rm -f (not guaranteed to be the same on all distros)
  • quote the command: "rm" or 'rm'

command rm -rf will also be a good alternative.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, this makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this breaks the fish shell.
I'd suggest to use the command rm -f alternative instead

.. get_lock_file_path() -- remove lock file
end

Expand Down
Loading