sdMarth
sdMarth

Reputation: 561

Launching Sublime Text from git bash causes terminal to be unresponsive until Sublime is closed

I've set up git bash to be able to launch Sublime Text by adding:

alias subl="/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"

into ~/.bash_profile

The problem is that when I open a project in git bash with:

subl .

Now, I can't use my git bash terminal until I close sublime text. Is there a better way of setting this up so that the terminal isn't blocked by the subl command?

Upvotes: 0

Views: 252

Answers (1)

OdatNurd
OdatNurd

Reputation: 22791

This hang is happening because your alias is executing sublime_text.exe instead of subl.exe.

On Windows, those two executables are different things; the first is the actual application itself, and the second is a small stub application that communicates requests to the running application (launching Sublime as needed) and then terminates.

Since you're executing sublime_text.exe here, bash is unhelpfully waiting until you quit Sublime before it returns control back to you. If you modify your alias to execute subl.exe instead (it's in the same location) then subl.exe will talk to the running Sublime and immediately terminate, so that bash can continue.

Note that this is not the case on all operating systems; on Linux for example subl is just an alias for the main Sublime binary. Thus this can catch you unaware if you're used to doing things on other systems.

Upvotes: 1

Related Questions