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

Improve error message when symlink failed on Windows #565

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
13 changes: 13 additions & 0 deletions src/cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,17 @@ rescue ex : Shards::ParseError
rescue ex : Shards::Error
Shards::Log.error { ex.message }
exit 1
rescue exc : File::AccessDeniedError
{% if flag?(:windows) %}
if exc.os_error == WinError::ERROR_PRIVILEGE_NOT_HELD && exc.message.try &.starts_with?("Error creating symlink")
Shards::Log.error { <<-TXT }
#{exc}

Shards needs symlinks to work. Please make sure to enable developer mode:
https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
TXT
exit 1
end
{% end %}
raise exc
end