Skip to content

Commit

Permalink
Don't run the installation script on windows
Browse files Browse the repository at this point in the history
Windows is not a supported OS. Therefore, the installation script
shouldn't run when on this system.

This commit adds a check before the script runs. If the system is
Windows based, the installation won't run and a message will be shown.
  • Loading branch information
luismiramirez committed Jun 18, 2024
1 parent af1a982 commit 990f3b2
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 990f3b2

Please sign in to comment.