Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:DB hangs in GVim when attempting to open interactive console #51

Open
dexterous opened this issue Nov 6, 2019 · 10 comments
Open

:DB hangs in GVim when attempting to open interactive console #51

dexterous opened this issue Nov 6, 2019 · 10 comments

Comments

@dexterous
Copy link

Per README, if only connection URL is provided and SQL string / file is omitted, it should spawn an interactive console. However, when executed in GVim, the Vim just locks up.

I have tpope/vim-dispatch installed and running...

Start postgresql://...

... does open psql in interactive mode (albeit) within the Ex bar.

With a little experimentation, I found that taking off the silent at https://github.com/tpope/vim-dadbod/blob/master/autoload/db.vim#L206

silent execute 'Start' escape(cmd, '%#')

... does the trick.

@tpope
Copy link
Owner

tpope commented Nov 17, 2019

That's unexpected. Does :silent Start cmd.exe lock up the same way?

@vadz
Copy link

vadz commented Nov 11, 2024

FWIW this bug is still present when using the current version (i.e. fe5a55e (Add Snowflake support (#174), 2024-10-18)) with gvim 9.0.1677 under Unix.

Removing silent fixes it.

@tpope
Copy link
Owner

tpope commented Nov 12, 2024

If it's the Start line causing it, it's probably a dispatch.vim issue. When you delete the silent to make it work, what adapter does it use?

@vadz
Copy link

vadz commented Nov 12, 2024

Sorry for being clueless, but how do I find out which adapter is used, exactly?

@tpope
Copy link
Owner

tpope commented Nov 12, 2024

What happens when you run it?

@vadz
Copy link

vadz commented Nov 12, 2024

If I run it without changing the plugin, GVim just hangs, with :DB sqlite3://... in the command line and nothing else happening until I (blindly) type .q<Enter>, after which it gets back to normal mode (Ctrl-C doesn't work).

If I remove silent, it shows SQLite prompt which I can use more or less normally (except the usual readline keys don't work).

FWIW I think I'm not using any adapter at all, i.e. exists(':Start:') returns 0 for me.

@tpope
Copy link
Owner

tpope commented Nov 12, 2024

FWIW I think I'm not using any adapter at all, i.e. exists(':Start:') returns 0 for me.

Is that a typo? The correct check is exists(':Start').

@vadz
Copy link

vadz commented Nov 12, 2024

FWIW I think I'm not using any adapter at all, i.e. exists(':Start:') returns 0 for me.

Is that a typo? The correct check is exists(':Start').

Yes, sorry, this was indeed a typo, I've checked the correct command.

Rereading all this now, I think there was a misunderstanding: I've tried using :DB after installing this plugin and was surprised that it hung and went looking for an existing issue and found this one, which seemed very similar, but it looks like it's not the same thing: this one is about :Start not working as intended, apparently, while my problem is that silent '!... doesn't show anything — which is, AFAIK, perfectly normal.

I.e. I believe my problem is addressed by just

diff --git a/autoload/db.vim b/autoload/db.vim
index a89a6db..56bb2a9 100644
--- a/autoload/db.vim
+++ b/autoload/db.vim
@@ -470,7 +470,7 @@ function! db#execute_command(mods, bang, line1, line2, cmd) abort
       if exists(':Start') == 2
         silent execute 'Start' escape(cmd, '%#')
       else
-        silent execute '!'.escape(cmd, '!%#')
+        execute '!'.escape(cmd, '!%#')
         redraw!
       endif
     else

Sorry for the confusion.

@tpope
Copy link
Owner

tpope commented Nov 12, 2024

Okay, yeah, distinct issue but possibly with the same cause. I bet this is contingent on whether or not 'guioptions' contains !.

@vadz
Copy link

vadz commented Nov 12, 2024

You're right, my guioptions is set to r and adding ! to it lets :DB work even with silent, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants