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

go get closes 'cmd' or 'powershell' terminal on Windows #22121

Closed
pietromenna opened this issue Oct 3, 2017 · 13 comments
Closed

go get closes 'cmd' or 'powershell' terminal on Windows #22121

pietromenna opened this issue Oct 3, 2017 · 13 comments

Comments

@pietromenna
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.9 Windows / AMD64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

architecture: amd64
os: Windows 10

What did you do?

  1. Open a Windows terminal, can be either cmd or powershell
  2. Type go get github.com/go-sql-driver/mysql, but this is only an example, any repository has the same behaviour.
  3. When it finishes, it closes the Window for cmd or powershell. This makes impossible to run go get inside batch script.

What did you expect to see?

Expected behavior is same as on Linux. When finishes downloading, to leave the prompt on the current terminal or shell.

What did you see instead?

It closed the current terminal (cmd or powershell)

@alexbrainman
Copy link
Member

@pietromenna is it possible that you have go.bat file somewhere in your PATH that gets executed before go command does? For example:

c:\Users\Alex\dev\src\a>dir
 Volume in drive C has no label.
 Volume Serial Number is 9012-A870

 Directory of c:\Users\Alex\dev\src\a

04/10/2017  03:49 PM    <DIR>          .
04/10/2017  03:49 PM    <DIR>          ..
04/10/2017  03:47 PM                 6 go.bat
08/09/2017  12:24 PM             1,301 main.go
18/08/2017  03:35 PM             1,349 main_test.go
               3 File(s)          2,656 bytes
               2 Dir(s)  408,578,072,576 bytes free

c:\Users\Alex\dev\src\a>type go.bat
exit

c:\Users\Alex\dev\src\a>go get github.com/go-sql-driver/mysql

Running last command will just close my command window.

Alex

@ghost
Copy link

ghost commented Oct 4, 2017

http://nurmi-labs.blogspot.com/2016/11/git.html

Any differences running your example command in the following?

C:\Programmer\Git\git-bash.exe --cd-to-home

%SystemRoot%\system32\cmd.exe

Adjust the PATH for git-bash.exe to your installation.

@pietromenna
Copy link
Author

@alexbrainman Thanks for your help. It was not the case. I tried:

where go
C:\Go\bin\go.exe

So it is not a batch file.

@forskning When executed on bash the problem is gone. But somehow this is still a bug, it does not work native on Windows. The expectation remains: it should work with cmd or at least powershell.

Is there any debugging which I could run on my side to help to identify the root cause?

@ghost
Copy link

ghost commented Oct 4, 2017

@pietromenna In your opening entry for this thread you mentioned batch files.

IIRC, confer to the link I provided, Git-2.10.0-32-bit.exe being an older version, I believe when running the installer, the current version likely is not different in this respect, one has the option to utilise "Git from Git Bash Only".

Do you recall which option you selected in the installer window "Adjusting your PATH environment"?

@pietromenna
Copy link
Author

@forskning we have some batch files, but the same problem occurs with executing go.exe directly.

I looked into the link you provided, and confirmed that using from bash which comes with git, the problem does not happen.

It must not be mandatory to execute from bash when you run on Windows. That is my point. I reproduced installing from scratch in 2 Windows machines. This means it is not a specific setting.

@ghost
Copy link

ghost commented Oct 4, 2017

This means it is not a specific setting.

So neither VARIABLES nor executables on the PATH are responsible.

@pietromenna
Copy link
Author

The problem is not with Go but with Git. Installing version 2.14.1 of git solves the problem.

Thank you so much @forskning for your help!

@dscho
Copy link

dscho commented Oct 5, 2017

The problem is not with Go but with Git. Installing version 2.14.1 of git solves the problem.

It's not really a solution, of course, but a workaround.

Other users found Git for Windows' bug tracker and opened a ticket there: git-for-windows/git#1312.

@Urmeli0815
Copy link

Still happening to me and I have this git version installed: git version 2.14.2.windows.1

What is interesting is that in Task-Manager the shell process still exists, I tried it with both cmd.exe and powershell.exe.

@pietromenna
Copy link
Author

@Urmeli0815 That is the version which has the problem. It is pointed out in the link by @dscho. Look at this link. Install 2.14.1 and everything will just work!

@dscho
Copy link

dscho commented Oct 12, 2017

2.14.2.windows.1

The problem is the trailing .1. the version that has the fix is 2.14.2.windows.2. (If you wait an hour or three, you will even be able to get 2.14.2.windows.3)

Install 2.14.1 and everything will just work!

@pietromenna please do not suggest to downgrade, at least do not call it a fix. I went through quite an effort to release Git for Windows v2.14.2(2) to fix this bug, so suggesting to downgrade is just like a slap in my face.

@pietromenna
Copy link
Author

@dscho I meant no offence, I just shared what I did.

I am glad a new version which fixes the issue as been released! 👍

@dscho
Copy link

dscho commented Oct 15, 2017

@pietromenna I understand the need to work around things quickly when you do not have time. However, in the interest of making all software better, all I ask is to go to the appropriate channel (in this case, it would have been Git for Windows' bug tracker and work with me (or other frequent Git for Windows contributors) to fix the bug.

No big harm done, but let's work together in the future, okay?

@golang golang locked and limited conversation to collaborators Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants