Allow extra options to be passed to Muontrap via app env

pull/974/head
connor rigby 2019-01-25 09:27:54 -08:00 committed by Connor Rigby
parent bc668b5ccd
commit a5b03a6f3b
No known key found for this signature in database
GPG Key ID: 29A88B24B70456E0
1 changed files with 9 additions and 5 deletions

View File

@ -21,6 +21,9 @@ defmodule Farmbot.FarmwareRuntime do
runtime_dir: "/tmp/farmware_runtime" runtime_dir: "/tmp/farmware_runtime"
""") """)
@muontrap_opts Application.get_env(:farmbot_core, __MODULE__)[:muontrap_opts]
@muontrap_opts || []
@packet_header_token 0xFBFB @packet_header_token 0xFBFB
@packet_header_byte_size 10 @packet_header_byte_size 10
@ -124,11 +127,12 @@ defmodule Farmbot.FarmwareRuntime do
exec = System.find_executable(manifest.executable) exec = System.find_executable(manifest.executable)
installation_path = install_dir(manifest) installation_path = install_dir(manifest)
opts = [ opts =
env: env, Keyword.merge(@muontrap_opts,
cd: installation_path, env: env,
into: IO.stream(:stdio, :line) cd: installation_path,
] into: IO.stream(:stdio, :line)
)
# Start the plugin. # Start the plugin.
{cmd, _} = spawn_monitor(MuonTrap, :cmd, [exec, manifest.args, opts]) {cmd, _} = spawn_monitor(MuonTrap, :cmd, [exec, manifest.args, opts])