-
Notifications
You must be signed in to change notification settings - Fork 123
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
ANSI escape sequenceの出力に制限をかける #386
ANSI escape sequenceの出力に制限をかける #386
Conversation
こっちの問題ですが、もしかしてCP932のターミナルだったら同様に色を止めた方がよい? |
|
あとVOICEVOX ENGINEのことはよくわかっていないのですが、ENGINEが悪いわけではないと思います。コマンドプロンプトのことを考えたらWindowsではそもそもANSIなんか出さずにWin32で色を出すべきで、coloramaもそうしているので。 |
そう考えるとやるべきなのはfwdansiを使い、tracing-subscriberからのANSI escape sequenceをWin32の色に変換することなのですが、そこまでやるべきかどうか... (追記) 10行未満くらいの追加で収まりそうではあるんですが |
まあこのリポジトリが取り組むべき本質ではないと思うので、手っ取り早くとにかく色を付けるのをなくすのが良いのかなと思いました! |
|
これ、よく考えたら
と+1-0行の変更でいいんですよね。今のPRの状態でちゃんと動作するとは思いますが、単に色を無効化する方がいいかもしれません。 |
なるほどです!!ちなみにどこかに設定がある感じでしょうか 👀 |
このPRの |
なるほどです!!手っ取り早くそれもありなのかなと思いました!! |
リリースビルドの判定ではないですが、コマンドプロンプトだけ弾くようにしました。 この変更量とコメントならどうでしょうか? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
うーん、正直全くよくわかってないのですが、LGTMで!!
ぱっと見では、現時点のコードで適切そうな印象です。また私の環境(macOS)で試したところでは、意図通りに動いていそうでした。以前のコアと今回の PR のコア双方について、エンジン経由で使ってみて得られた出力を比較してみました( 以前のコア:
この PR のコア:
Windows については未検証です……。どなたか確認していただければ幸いです。 |
@PickledChair |
Windows環境で検証してみます |
検証情報require "voicevox"
puts "Voicevox::VERSION: #{Voicevox::VERSION}"
puts "Voicevox.core_version: #{Voicevox.core_version}"
Voicevox.new("./voicevox_core/open_jtalk_dic_utf_8-1.11") E:\voicevox-project\voicevox.rb>SET RUBY_DLL_PATH=E:/voicevox-project/voicevox_core/target/release
E:\voicevox-project\voicevox.rb>bundle exec ruby __gi_test.rb > __gi_test1.txt 2>&1
E:\voicevox-project\voicevox.rb>SET RUBY_DLL_PATH=./voicevox_core
E:\voicevox-project\voicevox.rb>bundle exec ruby __gi_test.rb > __gi_test2.txt 2>&1
|
なるほどです、検証ありがとうございます!(Ruby wrapper も検証用途に便利ですね)。ちなみになのですが、PowerShell に出力を流すときは文字色がつきそうでしたでしょうか? 👀 (今回の PR は PowerShell のことも考慮しているようなので、一応お聞きしたいと思いました)macOS では iTerm2 ではこれまで通り色がつきました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
( @sevenc-nanashi Windows での検証ありがとうございました、助かりました!)
これも @qwerty2501 さんにレビュー依頼が行っていますが、多分問題ないと思うのでマージします……! |
内容
一般的なアプリケーションのように、出力がファイルにリダイレクトされていたり
TERM=dumb
となっているときにはANSI escape sequenceを出さないようにします。関連 Issue
Fixes #385.
その他