Custom terminal switches to default cmd.exe when trying to open a file with Atom


#1

I’m using Cmder under Windows 10 along with Git Bash and Linux command line tools installed. It’s very convenient because it allows me to work in the terminal as if I’m under Linux or Mac OS. However, whenever I type something like atom file.go I can see how my terminal switches to Windows default cmd.exe and then waits for my input. After I type the command again, Atom opens the specified file. Why can’t it work along with my pre-set terminal configuration? What’s going wrong and how do I troubleshoot it?


#2

I’m not sure what the cause is, but in my experience, that is a result of invoking Atom from within a Git-Bash window. You should try invoking Atom from one of the default cmd.exe-wrapping Cmder tabs.


#3

The --wait feature requires the ability to get the PID of certain Atom processes and then block waiting until that PID exits. On Windows, every terminal seems to have a different way of getting a hold of and blocking on PID exits. We don’t have the resources to support all of them directly, so we use a system that attempts to launch Atom through cmd.exe on Windows. Some terminal programs don’t work well with this system. It would seem that Cmder is one of those.


#4

That’s very unfortunate. Isn’t there anything I can do? As far as I understand and managed to google this issue, it has more to do with invoking Atom from Git Bash rather than Cmder itself which is a wrapper in this case. Curiously, simply typing Atom works under Cmder (Git Bash) while typing Atom file.go launches cmd.exe.


#5

The whole point of my post is to make calling Atom open a file work alongside Git Bash thoughz


#6

It is problematic, we agree and we would like to see it fixed (of course while still maintaining the rest of Atom’s features :grinning:). If you want, you could take a look at the history of the problem starting here:

And see if there’s anything that we missed?


#7

The great thing about Cmder is that you can set different startup tasks to invoke different shells. I use the default for most everything, but I have a PowerShell task and a Git-Bash task for when I need them.

Anyway, I found a workable solution for you that doesn’t involve leaving Git-Bash. You can set up a ConEmu task with the instruction cmd /k "atom -d . && exit" -cur_console:n, which will open the directory of the active tab in Atom. A new tab is opened for the purpose and then immediately quits.


#8

Unfortunately, it doesn’t seem to work. All it does is switch to cmd.exe and wait for my input.


#9

I think I managed to find a fix by one of your guys namely damieng here.

Yeah, I just checked, it works. Can you guys implement this into the next update or something?


#10

That’s not helpful. If you show me what your task window looks like, maybe I can show you what you did wrong. I set it up in my instance of Cmder and activated it from my instance of Git Bash. It works.


#11

According to the thread, it’s in 1.9.0 right now, so all you would have to do is go beta.


#12

What I’ve done was edit the script as the fix author suggested. I must’ve missed the part that it’s already in the new beta version. Anyway, thanks for trying to assist me! You pointed me in the right direction by saying it’s how Atom interacts with Git Bash. I was able to google the fix (fixes even) after that.


#13

I have this problem, the fix mentioned above alias atom="atom.cmd" did work. but the terminal plus package now fails to initialize. I’m just going to leave things as they are for now.