Skip to content

Commit

Permalink
Merge pull request #948 from appsignal/avoid-installation-in-windows
Browse files Browse the repository at this point in the history
Don't run the installation script on windows
  • Loading branch information
luismiramirez authored Jun 21, 2024
2 parents 772d44c + 990f3b2 commit fac83f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changesets/don-t-run-the-insallation-script-on-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: patch
type: fix
---

When running the installation script on Microsoft Windows, some components threw an error. AppSignal doesn't support Windows, so the installation script won't run on Windows anymore. Preventing errors from raising.
19 changes: 17 additions & 2 deletions lib/mix/tasks/appsignal.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@ defmodule Mix.Tasks.Appsignal.Install do
use Mix.Task
@shortdoc "Installs AppSignal into the current application"

def run([]) do
def run(args) do
case :os.type() do
{:win32, _} ->
"""
We've detected that you're running Windows. Unfortunately, AppSignal does not support Windows at this time.
"""
|> IO.puts()

exit(:shutdown)

_ ->
do_run(args)
end
end

defp do_run([]) do
header()

"""
Expand All @@ -17,7 +32,7 @@ defmodule Mix.Tasks.Appsignal.Install do
|> IO.puts()
end

def run([push_api_key]) do
defp do_run([push_api_key]) do
config = %{otp_app: otp_app(), active: true, push_api_key: push_api_key, request_headers: []}
Application.put_env(:appsignal, :config, config)
Appsignal.Config.initialize()
Expand Down

0 comments on commit fac83f3

Please sign in to comment.