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

Cannot output to pipe when -f option is specified #354

Open
naokikimura opened this issue Mar 2, 2020 · 0 comments
Open

Cannot output to pipe when -f option is specified #354

naokikimura opened this issue Mar 2, 2020 · 0 comments

Comments

@naokikimura
Copy link

naokikimura commented Mar 2, 2020

When the -f option is specified in CLI, there is no way to write the analysis result to the pipe.

  • When the -f option is specified and --output-file option is not specified, the analysis result is output to a file with the default file name.
  • An error will occur if you connect to a pipe by giving /dev/null to the --output-file option with the -f option specified.
% rails_best_practices --silent -f xml --output-file /dev/stdout | cat       
Traceback (most recent call last):
        9: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/bin/rails_best_practices:23:in `<main>'
        8: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/bin/rails_best_practices:23:in `load'
        7: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/bin/rails_best_practices:7:in `<top (required)>'
        6: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        5: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        4: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/lib/rails_best_practices/command.rb:15:in `<top (required)>'
        3: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/lib/rails_best_practices/analyzer.rb:75:in `output'
        2: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/lib/rails_best_practices/analyzer.rb:278:in `output_xml_errors'
        1: from /Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/lib/rails_best_practices/analyzer.rb:278:in `open'
/Users/kimuranaoki/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/rails_best_practices-1.20.0/lib/rails_best_practices/analyzer.rb:278:in `initialize': Permission denied @ rb_sysopen - /dev/stdout (Errno::EACCES)

I want to output the analysis result as XML and transform it with XSLT. I don't want to output an intermediate XML file.

Why open output file in w+ mode?

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

1 participant