Probably I could get the resulting data structure, but the real challenge I 
think is to suppress all the stdout messages issued by many different mix tasks 
used in recompilation process.

Here is the example:
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel/typespec.ex#L152
 
<https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel/typespec.ex#L152>
When we trigger recompilation, we still get this warning to the main window’s 
stdout.

The only way I can see how to remove it from stdout is to override the 
:elixir_errors.erl_warn/3 function.

> On 23 Feb 2021, at 10:59, José Valim <[email protected]> wrote:
> 
> Hi Boris!
> 
> The compile mix tasks already returns all diagnostics as a data structure, so 
> I would recommend you to implement your own IEx.Helper.recompile so you have 
> access to those diagnostic values. It should be relatively straight-forward.
> 
> On Tue, Feb 23, 2021 at 7:12 AM Boris Kuznetsov <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi,
> 
> I’m working on console application written in elixir.
> I would like to make it “live editable”, so I run it with mix run --no-halt.
> 
> It has shortcut to trigger recompilation with IEx.Helpers.recompile().
> 
> The issue I have is that many parts of elixir write to stdout when you 
> trigger recompilation.
> 
> So far, it has two type of messages:
> 1) success / failure messages, handled by Mix.shell.info/ 
> <http://mix.shell.info/>1, Mix.shell.error/1
> 2) compilation warning messages, handled by :elixir_errors module.
> 
> Mix.shell allows you to define custom behaviour for its actions with 
> Mix.shell(Custom.MixShell).
> 
> To do the same thing with :elixir_errors Erlang’s module, you have to 
> re-define it from scratch.
> 
> Is it possible to have custom backend for :elixir_errors module?
> 
> The issue I’m trying to resolve is my application has many virtual windows 
> and I want to show all warnings / errors in separate windows, i.e. redirect 
> output from stdout to some file as an example.
> 
> Thank you.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/BFA65702-1BBF-4D75-98AD-99FB782CEF6E%40achempion.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/BFA65702-1BBF-4D75-98AD-99FB782CEF6E%40achempion.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B__7bmyoKyW2b588688gD96tQbmQxCYh71o3-xvKSfCA%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B__7bmyoKyW2b588688gD96tQbmQxCYh71o3-xvKSfCA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/816E4194-D626-446B-AA2B-B9519B24130D%40achempion.com.

Reply via email to