-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# config/.credo.exs | ||
%{ | ||
configs: [ | ||
%{ | ||
name: "default", | ||
checks: [ | ||
{Credo.Check.Refactor.MapInto, false}, | ||
{Credo.Check.Warning.LazyLogging, false}, | ||
{Credo.Check.Readability.LargeNumbers, only_greater_than: 86400}, | ||
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, parens: true} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
defmodule NervesSSH.Exec do | ||
@doc """ | ||
Run one command coming over ssh | ||
@moduledoc """ | ||
This module contains helper methods for running commands over SSH | ||
""" | ||
|
||
@doc """ | ||
Run one Elixir command coming over ssh | ||
""" | ||
@spec run_elixir(charlist()) :: {:ok, binary()} | {:error, binary()} | ||
def run_elixir(cmd) do | ||
try do | ||
{result, _env} = Code.eval_string(to_string(cmd)) | ||
{:ok, inspect(result)} | ||
catch | ||
kind, value -> | ||
{:error, "** (#{kind}) #{inspect(value)}"} | ||
end | ||
{result, _env} = Code.eval_string(to_string(cmd)) | ||
{:ok, inspect(result)} | ||
catch | ||
kind, value -> | ||
{:error, "** (#{kind}) #{inspect(value)}"} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters