My elixir script seems to choke on the data that is returned by an external executable.
this signer program takes two arguments and returns a digest string.
> # Usage: signer [datahex] [privatehex]
> ./signer 64bd... b3bd...
> 3a9c2e0220540ea2d2edbe18...
I can run it manually and it works great.
But when I run it with this elixir/erlang code:
"signer test string" |> String.to_char_list |> :os.cmd
it gives an error:
'2017/05/11 07:16:44 encoding/hex: invalid byte: U+0074 \'t\'\n'
So how do I get :os.cmd not to choke on the returned string? do I need to convert it somehow?
EDIT:
I thought it might be important to tell you I'm able to get it to work fine with other programs:
"notepad test.txt" |> String.to_char_list |> :os.cmd
results in notepad opening an existing file in the current working directory called test.txt. So I don't think the problem is with the call itself, but what do I know?
System.cmd("signer", ["test", "string"])
? And just to make sure, does./signer test string
work manually? – Dogbert