Skip to content

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

Closed
@neowit

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.

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