brunobeltran / conque

Automatically exported from code.google.com/p/conque
0 stars 0 forks source link

subprocess callback never terminates #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a subprocess with callback
    function! ConqueMake(...)
        let g:ConqueMakeOutput = ''
        let g:ConqueCallbackCount = 0
        if a:0 > 0
            let build_command = a:1
        else
            let build_command = &makeprg
        endif
        let p = getpos('.')
        let sp = conque_term#subprocess(build_command)
        call sp.set_callback('ConqueQuickfixOutput')
        call setpos('.', p)
        echo 'Executed: ' . build_command
    endfunction
2. Define the subprocess callback:
    function! ConqueQuickfixOutput(output)
        if len(a:output) > 0
            echo a:output
            let g:ConqueMakeOutput .= substitute(a:output, '^M','', 'g')
            cgete g:ConqueMakeOutput
        endif

        if len(getqflist()) > 0
            echo 'Compiler errors and warnings: 'len(getqflist())
        else
            echo 'Build successfull.'
        endif
        " Send out make autocmd event
        doautoall QuickFixCmdPost make

        echo 'Is active count: ' . g:ConqueCallbackCount
        let g:ConqueCallbackCount += 1
    endfunction
3. call ConqueMake('cat /etc/passwd')

What is the expected output? What do you see instead?

The callback should called with new output until the process finishes, about 
once a second if there is output.

Unfortunatly, when running a command as a subproces the close function never 
gets called and the callback gets called over and over again.

What version of the product are you using? On what operating system?

 * Arch Linux 64bit
 * Vim 7.3
 * Python 2.7/Python 3.2.2 (both installed)
 * Conque 2.3

Please provide any additional information below.

I've created a quick patch that fixes the problem, but I'm not quite sure if 
this is the best solution. It would be better to use the auto_read function 
instead of the bare read (as it has the close callback implemented).

I'm attaching the patch with the quick fix.

Original issue reported on code.google.com by queezyth...@gmail.com on 20 Nov 2011 at 3:23

Attachments: