view src/testdir/test_job_fails.vim @ 12765:c1347c968d31 v8.0.1260

patch 8.0.1260: using global variables for WaitFor() commit https://github.com/vim/vim/commit/ab8b1c14a31e36ae87cc7e13c4a75318d513fc7b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 4 19:24:31 2017 +0100 patch 8.0.1260: using global variables for WaitFor() Problem: Using global variables for WaitFor(). Solution: Use a lambda function instead. Don't check a condition if WaitFor() already checked it.
author Christian Brabandt <cb@256bit.org>
date Sat, 04 Nov 2017 19:30:06 +0100
parents e0b783389bea
children 415185e2c970
line wrap: on
line source

" This test is in a separate file, because it usually causes reports for memory
" leaks under valgrind.  That is because when fork/exec fails memory is not
" freed.  Since the process exists right away it's not a real leak.

source shared.vim

func Test_job_start_fails()
  if has('job')
    let job = job_start('axdfxsdf')
    if has('unix')
      call WaitFor({-> job_status(job) == "dead"})
    else
      call WaitFor({-> job_status(job) == "fail"})
    endif
  endif
endfunc