Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't pass stderr: :stdout or stdout: :stderr #4

Closed
ivan opened this issue Apr 14, 2017 · 2 comments
Closed

Can't pass stderr: :stdout or stdout: :stderr #4

ivan opened this issue Apr 14, 2017 · 2 comments

Comments

@ivan
Copy link

ivan commented Apr 14, 2017

@type command_option :: lists

    {:stdout, :stderr | output_device_option} |
    {:stderr, :stdout | output_device_option} |

but neither stderr: :stdout or stdout: :stderr work; e.g.

Exexec.run(["/usr/bin/ssh" | args], stdout: true, stderr: :stdout, sync: true, env: env)

yields

** (FunctionClauseError) no function clause matching in Exexec.ToErl.output_device_option_to_erl/1
    (exexec) lib/exexec/to_erl.ex:76: Exexec.ToErl.output_device_option_to_erl(:stdout)
    (exexec) lib/exexec/to_erl.ex:72: Exexec.ToErl.command_option_to_erl/2
    (exexec) lib/exexec/to_erl.ex:14: anonymous fn/2 in Exexec.ToErl.command_options_to_erl/1
    (elixir) lib/enum.ex:1774: Enum."-reduce/3-lists^foldl/2-0-"/3
    (exexec) lib/exexec/to_erl.ex:13: Exexec.ToErl.command_options_to_erl/1
    (exexec) lib/exexec.ex:125: Exexec.run/2
    [...]

This fixes it, but I don't know if it's the right place to fix it:

diff --git a/lib/exexec/to_erl.ex b/lib/exexec/to_erl.ex
index 0abf38c..444d79f 100644
--- a/lib/exexec/to_erl.ex
+++ b/lib/exexec/to_erl.ex
@@ -76,6 +76,8 @@ defmodule Exexec.ToErl do
   def output_device_option_to_erl(:null), do: :null
   def output_device_option_to_erl(:close), do: :close
   def output_device_option_to_erl(:print), do: :print
+  def output_device_option_to_erl(:stdin), do: :stdin
+  def output_device_option_to_erl(:stdout), do: :stdout
   def output_device_option_to_erl(path) when is_binary(path), do: to_char_list(path)
   def output_device_option_to_erl(pid) when is_pid(pid), do: pid
   def output_device_option_to_erl(fun) when is_function(fun, 3), do: fun
@lessless
Copy link

lessless commented Jul 7, 2018

@ericentin I'm considering to use exexec and this issue seems to be a real thing, as well as #3 . Do you have time to address them?

@ericentin
Copy link
Owner

Should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants