Skip to content

MacVim GUI does not report job_start() failure when executable does not exist #322

Closed

Description

@neowit

if job_start is called with an executable which does not exist then console version of macvim reports failure in callback function, while GUI does not.

Tested in MacVim from homebrew, exact version details see below.

Consider following demo.vim

" job start failure is reported in terminal, but not in GUI mode

function! MyCallback(...)
    " a:1 - channel, a:2 - message
    let l:msg = a:0 > 1 ? a:2 : ""

    echomsg l:msg
endfunction

function! JOB_START()
    let command = "aFakeCommand"

    let job = job_start(command, {"callback": function("MyCallback")})
endfunction    

First try console version of macvim
$ vim -u NONE -U NONE -N -S demo.vim

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 11 2016 19:06:30)
MacOS X (unix) version
Included patches: 1-2196
Compiled by Homebrew
Huge version without GUI.

:call JOB_START()

result:

executing job failed: Not a directory

Not the clearest message, but at least a hint of something wrong with the command.

Now run the same scenario in GUI
$ mvim -u NONE -U NONE -N -S demo.vim

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 11 2016 06:29:47)
MacOS X (unix) version
Included patches: 1-2196
Compiled by Homebrew
Huge version with MacVim GUI.

:call JOB_START()

result: nothing reported in :messages, job fails silently.
I did few tests and it looks like "callback" is not being called at all.

In case if anyone interested - my use-case is a vim plugin and works as follows:

  1. job_start() starts a server (java program)
  2. ch_open and ch_sendraw() are used to communicate with the server

If job_start() fails silently then there is no way for the end user to figure out why their action is not being executed.

Activity

  1. splhack commented on Aug 17, 2016

    @splhack
    Contributor

    No failure in this test https://github.com/macvim-dev/macvim/blob/46c4d4ac66aa2b129f4dcec9debfda606f72d4b3/src/testdir/test_job_fails.vim even though on GUI mode. I don't know callback should be called or not in this case.

  2. neowit commented on Aug 17, 2016

    @neowit
    Author

    Hello @splhack

    Thank you your feedback.

    My main reason for opening this issue was to point out an inconsistency.
    Normal vim and console macvim both invoke the callback on job failure, and it is only GUI mode of MacVim does not call the callback, hence my assumption that in GUI mode macvim does not behave correctly in this sort of situation.

  3. splhack commented on Aug 20, 2016

    @splhack
    Contributor
  4. splhack commented on Oct 3, 2016

    @splhack
    Contributor
  5. neowit commented on Oct 6, 2016

    @neowit
    Author

    Hello @splhack

    Unfortunately I am not familiar with vim build/patch process (I just write vim plugins) and not sure how to test that diff. Is there an instruction which explains this process?

  6. splhack commented on Oct 9, 2016

    @splhack
    Contributor
  7. neowit commented on Oct 17, 2016

    @neowit
    Author

    hello @splhack

    Just wanted to confirm that current version of macvim (8.0 includes patches: 1-32 ) handles job start failure as expected.
    Thank you for merging the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions