AshokEmrys / conque

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

Feature request: auto CloseOnEnd only if exit code == 0 #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When ConqueTerm_CloseOnEnd is set, the conque buffer will automatically close 
when the command has completed.

I would like it to automatically close *only if* the command completed 
successfully (i.e. returned exit/status code 0).

This means it would auto-close if I run a build process which succeeds, but if 
it fails the buffer will remain open to show me the error message.

This feature might want its own option, e.g. ConqueTermOnlyCloseOnSuccess.

I had a look around the code, but didn't find anything that might give me the 
process exit code.  ConqueSoleSubprocess looks a bit windowsy, whilst I'm on 
Linux!

Original issue reported on code.google.com by joeytwid...@gmail.com on 19 Jun 2012 at 8:59

GoogleCodeExporter commented 8 years ago
This should be fairly straightforward, although I won't have time to work on it 
too soon.

You want to look at the is_alive() method of conque_subprocess.py

http://code.google.com/p/conque/source/browse/trunk/autoload/conque_term/conque_
subprocess.py

The os.waitpid() function does return the status code of the process.

You should be able to pass that status code all the way back to the VimScript 
term_obj.close() fuction which is the one that decides if it should close the 
Vim buffer depending on user options. Somewhere around line 1397

http://code.google.com/p/conque/source/browse/trunk/autoload/conque_term.vim

Original comment by nicora...@gmail.com on 20 Jun 2012 at 3:37

GoogleCodeExporter commented 8 years ago
Thanks for the speedy advice!

I had a go, I might have got the error code, but got stuck passing it back to 
something that autoload/conque_term.vim can see.

Anyway no worries, it's not urgent.  I'm happy enough using my own option 
ConqueTerm_CloseOnEndIfSplit for now.

One issue I have there is that an unfocused conqueterm won't autoclose its 
window until I focus that window again.  Ideally it would just close itself in 
the background.

By the way, Conqueterms rocks!  And I have got ConqueTerm_ReadUnfocused working!

Original comment by joeytwid...@gmail.com on 20 Jun 2012 at 6:33