mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
Check for flyctl in default install locations (#2722)
This commit is contained in:
parent
5686771646
commit
303f78a418
3 changed files with 17 additions and 3 deletions
|
@ -302,7 +302,7 @@ defmodule Livebook.Runtime.Fly do
|
|||
end
|
||||
|
||||
defp find_fly_executable() do
|
||||
if path = System.find_executable("flyctl") do
|
||||
if path = System.find_executable("flyctl") || default_flyctl_path() do
|
||||
{:ok, path}
|
||||
else
|
||||
{:error,
|
||||
|
@ -311,6 +311,20 @@ defmodule Livebook.Runtime.Fly do
|
|||
end
|
||||
end
|
||||
|
||||
defp default_flyctl_path() do
|
||||
# Checks the default locations where flyctl gets installed using
|
||||
# the official instructions
|
||||
|
||||
home = System.user_home()
|
||||
|
||||
paths = [
|
||||
"/opt/homebrew/bin/flyctl",
|
||||
home && Path.join(home, ".fly/bin/flyctl")
|
||||
]
|
||||
|
||||
Enum.find(paths, fn path -> path && File.regular?(path) end)
|
||||
end
|
||||
|
||||
defp fetch_runtime_info(child_node) do
|
||||
# Note: it is Livebook that starts the runtime node, so we know
|
||||
# that the node runs Livebook release of the exact same version
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
File.cd!(System.fetch_env!("HOME"))
|
||||
File.cd!(System.user_home!())
|
||||
|
||||
flame_parent = System.fetch_env!("FLAME_PARENT") |> Base.decode64!() |> :erlang.binary_to_term()
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
File.cd!(System.fetch_env!("HOME"))
|
||||
File.cd!(System.user_home!())
|
||||
|
||||
%{
|
||||
node_base: node_base,
|
||||
|
|
Loading…
Reference in a new issue