-
Notifications
You must be signed in to change notification settings - Fork 64
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
Backport System.Job and System.Process.Job #513
Conversation
https://github.com/lambdalisue/vital-System-Job は MIT ライセンスみたいですけど vital に入れるなら NYSL になると思いますが、大丈夫ですかね? |
はい。そのつもりでライセンス部分消しました。 |
call extend(self._content, [leading . get(a:msg, 0, '')] + a:msg[1:]) | ||
endfunction | ||
|
||
function! s:stream.on_stderr(job, msg, event) abort |
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.
[vimlint] reported by reviewdog 🐶
EVL103: unused argument a:job
" Stream --------------------------------------------------------------------- | ||
let s:stream = {} | ||
|
||
function! s:stream.on_stdout(job, msg, event) abort |
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.
[vimlint] reported by reviewdog 🐶
EVL103: unused argument a:event
" Stream --------------------------------------------------------------------- | ||
let s:stream = {} | ||
|
||
function! s:stream.on_stdout(job, msg, event) abort |
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.
[vimlint] reported by reviewdog 🐶
EVL103: unused argument a:job
call s:_on_msg_cb(a:name, a:job, a:job.__channel, msg) | ||
endif | ||
sleep 1m | ||
let status = ch_status(a:job.__channel, a:options) |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: ch_status
\ 'timeout': 10000, | ||
\ 'out_cb': function('s:_on_msg_cb', ['stdout', job]), | ||
\ 'err_cb': function('s:_on_msg_cb', ['stderr', job]), | ||
\ 'exit_cb': function('s:_on_exit_cb', [job]), |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: function
call extend(self._content, [leading . get(a:msg, 0, '')] + a:msg[1:]) | ||
endfunction | ||
|
||
function! s:stream.on_stderr(job, msg, event) abort |
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.
[vimlint] reported by reviewdog 🐶
EVL103: unused argument a:event
\ 'mode': 'raw', | ||
\ 'timeout': 10000, | ||
\ 'out_cb': function('s:_on_msg_cb', ['stdout', job]), | ||
\ 'err_cb': function('s:_on_msg_cb', ['stderr', job]), |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: function
let job_options = { | ||
\ 'mode': 'raw', | ||
\ 'timeout': 10000, | ||
\ 'out_cb': function('s:_on_msg_cb', ['stdout', job]), |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: function
endfunction | ||
|
||
function! s:_read_channel_and_call_callback(job, name, options) abort | ||
let status = ch_status(a:job.__channel, a:options) |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: ch_status
doc/vital/System/Job.txt
Outdated
INTRODUCTION *Vital.System.Job-introduction* | ||
|
||
*Vital.System.Job* is a wrapper module of job feature which has introduced | ||
from Vim 8 or Neovim. |
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.
to provide an abstract layer that works both for Vim 8 and Neovim at the same time とかみたいに両方イけることを強調するとなお良さそう
doc/vital/System/Job.txt
Outdated
============================================================================= | ||
USAGE *Vital.System.Job-usage* | ||
|
||
The following code start "git status" and store its' stdout/stderr output in |
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.
s/'//
s/start/starts/
s/store/stores/
doc/vital/System/Job.txt
Outdated
"on_exit" A callback called when the process terminated. | ||
The {msg} is an exit status. | ||
|
||
Note that all attributes in the {options} is exposed to the job |
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.
s/is/are/
だいたいレビュー揃ってから修正開始します。 |
方針は超LGTM |
@haya14busa @thinca このモジュールって Vim 8 か NeoVim でしか動かないと思うのですが、そういうモジュールの場合、import() 時にエラーになる仕組みってないんでしたっけ? |
オフトピな話題ですみません。 |
現状import()時ではなく、is_available()などを明示的に呼び出して利用可能か確認するモジュールならある、という感じです (vimprocに依存してるConcurrentProcessなど)。あちらであの仕様にしたのは、「importはトップレベルでとにかく無条件に行って、プラギンの各関数でis_availableして、プラギンごとによしなに対処する」みたいなつくりが実用上便利だったからです。 今後この方針を変えるかどうか一度ちゃんと議論するのはよさそう。もちもん、それはこのpullreqとは別の独立したissueでだけど |
.travis.yml
Outdated
- ruby scripts/check-changelog.rb | ||
- bash scripts/script.sh |
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.
script.sh
はファイル名が何をするスクリプトか分かるように改名したほうが良いかもです.
|
||
function! s:job.wait(...) abort | ||
let timeout = get(a:000, 0, v:null) | ||
if timeout is# v:null |
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.
nit: ここは v:null
を持ち出さなくても
if a:0 > 0
return jobwait([self.__job], a:1)[0]
else
return jobwait([self.__job])[0]
endif
で良いかもです
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.
その場合 s:job.wait(v:null)
と明示的に指定できなくなるので少し表現力が下がってしまいます。
例えば s:job.wait(...)
を内部的に呼び出す別の関数が会った場合 v:null
を渡してもOKという状況のほうが使い勝手が高いと思います。
let msg = ch_read(a:job.__channel, a:options) | ||
call s:_on_msg_cb(a:name, a:job, a:job.__channel, msg) | ||
endif | ||
sleep 1m |
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.
なぜ 1m 待っているのかコメントがあると嬉しいかもです
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.
🆗
" Start job and return a job instance | ||
let job.__job = jobstart(a:args, job) | ||
let job.__status = job.__job > 0 ? 'run' : 'dead' | ||
let job.args = a:args |
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.
この args
プロパティは後で使っていない気がします
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.
前口頭で説明しましたが、この args
は後で参照できるように残してあります
|
||
function! s:is_supported(options) abort | ||
if get(a:options, 'background') && ( | ||
\ s:Prelude.is_string(get(a:options, 'input')) || |
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.
Prelude は一応廃止じゃなかったでしたっけ?(CC: @ujihisa)もしそうなら上記の s:t_list
みたいに自前でチェックしたほうが良いかもしれないです.
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.
Type
もあるし、とりあえずこれはこのままで行きます〜
echomsg printf( | ||
\ 'vital: System.Process.Job: %s', | ||
\ cmdline | ||
\) |
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.
nit: ここは .
で文字列結合で良い気も.
echomsg 'vital: System.Process.Job: ' . cmdline
やっと Travis 氏倒した…… 再レビューお願い致します |
endif | ||
" Without sleep, Vim would hung | ||
sleep 1m | ||
let status = ch_status(a:job.__channel, a:options) |
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.
[vimlint] reported by reviewdog 🐶
E118: Too many arguments for function: ch_status
倒せてなかったorz |
Backport System.Job and System.Process.Job from https://github.com/lambdalisue/vital-System-Job To fix travis for Neovim, the following are also performed - Use 'trusty' instead to upgrade cmake newer - Add requirements for build Neovim - Fix test scripts - Remove unnecessary flags to reduce dependencies - --enable-perlinterp - --enable-rubyinterp
drone で client9/misspell のビルドにコケてるけど beego/wetalk#32 っぽい?
|
@haya14busa ちょっと僕だと drone コケてるの直せないので確認していただけませんか? |
job restartしたら green になりました.が,これは根本的ソリューションではない... スペック低すぎてリソース足りなくて misspell ビルドできないってケースなのかもしれないですね... っらぃ... |
@haya14busa ビルドするのやめてバイナリ置いとくだけにします? misspell は割りと実装がゴリ押しなのでそのせいでビルドにメモリ食うのかも… |
ビルドで落ちるの健康に悪い(ビルドで落ちたら嫌だからコミットしたくないとか)のでバイナリ置けるのであればそうして頂けると助かりますー |
公式のnightly buildはどうでしょうか。 |
お、misspell とは違いますが、確かに neovim のビルドこれ使った方が良いかもですね。週末詳しくみてみます |
Building misspell might use lots of resource and be killed. #513 (comment) ref: https://github.com/client9/misspell#install
Building misspell might use lots of resource and be killed. #513 (comment) ref: https://github.com/client9/misspell#install
While non of code use rubyinterp. I simply removed it.
クソ面倒クセェ!!! |
Wait a bit before job.status() is called
ちょっと思う所あるから一旦おろします。 |
from https://github.com/lambdalisue/vital-System-Job
ついでに Travis で Neovim のテストも走らせています。
現状は
System.Job
だけです。