Skip to content

Commit f80f39e

Browse files
Improve error message when symlink failed on Windows (#565)
Resolves #556
1 parent 603ac12 commit f80f39e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cli.cr

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,17 @@ rescue ex : Shards::ParseError
162162
rescue ex : Shards::Error
163163
Shards::Log.error { ex.message }
164164
exit 1
165+
rescue exc : File::AccessDeniedError
166+
{% if flag?(:windows) %}
167+
if exc.os_error == WinError::ERROR_PRIVILEGE_NOT_HELD && exc.message.try &.starts_with?("Error creating symlink")
168+
Shards::Log.error { <<-TXT }
169+
#{exc}
170+
171+
Shards needs symlinks to work. Please make sure to enable developer mode:
172+
https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
173+
TXT
174+
exit 1
175+
end
176+
{% end %}
177+
raise exc
165178
end

0 commit comments

Comments
 (0)