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

use go#util#system(), go#util#shell_errors() instead of system(), v:shell_error #801

Merged
merged 2 commits into from
Apr 26, 2016

Conversation

mattn
Copy link
Contributor

@mattn mattn commented Apr 15, 2016

errors from guru is ignored because when using vimproc. maybe having another issues with vimproc.

let s:vim_shell_error = get(g:, 'gocomplete#shell_error_function', 'vimproc#get_last_status')
else
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
let s:vim_shell_error = ''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storange indentation, will fix.

fu! s:system(str, ...)
return call(s:vim_system, [a:str] + a:000)
endf

fu! s:gocodeShellescape(arg)
if go#vimproc#has_vimproc()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be fixed as well, completion is broken with this.

@mattn
Copy link
Contributor Author

mattn commented Apr 16, 2016

Fixed. But I need to check more.

@mattn
Copy link
Contributor Author

mattn commented Apr 16, 2016

Do you prefer go#util#System or go#util#Shellerror ?


function! go#util#system(str, ...)
return call(s:vim_system, [a:str] + a:000)
endfunction
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had time due my new son :) So I just had a new idea and curious about your thought. What if we add a function that returns both the output and shell error. A list that contains the following [out, shell_error] ? This way we could write code like this:

let [out, shell_error] = go#util#Run("command ...")
if shell_error != 0 
    return -1
endif

// continue with out

This would make it more safer to use and would emulate the way we use it in Go. Let me know what you think. We can do it in another PR btw :)

@fatih
Copy link
Owner

fatih commented Apr 24, 2016

Do you prefer go#util#System or go#util#Shellerror ?

Checkout my other comment. For this question go#util#System is good 👍

@fatih fatih merged commit f830d0d into fatih:master Apr 26, 2016
@fatih
Copy link
Owner

fatih commented Apr 26, 2016

Thanks @mattn 👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants