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

Ctrl-C closes the console #192

Closed
kjeremy opened this issue Jun 11, 2015 · 11 comments
Closed

Ctrl-C closes the console #192

kjeremy opened this issue Jun 11, 2015 · 11 comments

Comments

@kjeremy
Copy link

kjeremy commented Jun 11, 2015

In trying to use git through ConsoleZ I invoke it with the following command: PathToGit\Git\git-cmd.exe --command=PathToGit\Git\usr\bin\bash.exe --login -i

Hitting CTRL-C closes the console, not the current executing program. This is a regression from the git-1.9.5-preview release.

@dscho
Copy link
Member

dscho commented Jun 11, 2015

Is this not a ConsoleZ issue?

@kjeremy
Copy link
Author

kjeremy commented Jun 11, 2015

It may be that whatever changed triggers this issue in ConsoleZ. I'm not really sure except that this setup did work in the past.

@dscho
Copy link
Member

dscho commented Jun 12, 2015

The change you are referring to is most likely that we provide git-cmd.exe, and previously you used cmd.exe. It could be that a special flag needs to be used when creating that new process in git-cmd.exe, maybe CREATE_NEW_PROCESS_GROUP (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863%28v=vs.85%29.aspx for all available flags).

@kjeremy it would be good if you could try to patch Git accordingly (see https://github.com/git-for-windows/git/wiki/Package-management#build-packages-from-locally-patched-sources for details).

@linquize
Copy link

Relate to #181?

@albertosantini
Copy link

Well, something is different.

I have been catching SIGINT event in Node.js context.
Starting the app in ConEmu or in git-cmd context, the event is trapped correctly.

It is ignored if I execute the app in git-bash context,

Sadly, I cannot reproduce it with a test case.

P.S.: Maybe I got something.

You should notice a difference executing this snippet using node or winpty node

node -e "var http = require('http'); http.createServer().listen(1337, '127.0.0.1'); process.on('SIGINT', function () { console.log('Got SIGINT'); process.exit(0); });"

After starting the command, press Ctrl-C.

@kjeremy
Copy link
Author

kjeremy commented Jun 17, 2015

Looks like PR #205 will fix this.

@cbucher
Copy link

cbucher commented Jun 18, 2015

Presently, when you press CTRL-C, git-cmd is terminated.
Why? because no event handler is registered, in this case the default behavior is to terminate the current process.
You can verify by yourself, press CTRL-C, git-cmd disappear from the task manager.

ConsoleZ launches git-cmd, inject a dll in git-cmd to read the console buffer and interact with this process and monitors the termination of git-cmd.
When git-cmd is terminated, ConsoleZ closes the tab.

@calle2010
Copy link

@cbucher Which version of Git for Windows do you use? I can't reproduce the behavior. Ctrl-C in git-cmd.exe just brings up a new prompt.

@cbucher
Copy link

cbucher commented Jun 18, 2015

v2.4.3.windows.1

@bviktor
Copy link

bviktor commented Jun 18, 2015

@calle2010 I believe he means git-cmd.exe --command=usr\bin\bash.exe --login -i not just git-cmd.exe on its own. The latter isn't really useful since it lacks a big portion of the command line tools that come with Git 2 (unless you modify PATH manually).

For reference, let me copy-paste my summary from issue #96:

  • usr\bin\bash.exe --login -i: this is what I had to use with Git1 (without the usr\ part). Works, but git commands are unavailable
  • cmd\git.exe: it's just the git binary, not the shell
  • git-cmd.exe: works, but misses other stuff like grep
  • git-cmd.exe --command=usr\bin\bash.exe --login -i: seems to work, opens a new shell on a new tab and all the shell and git commands are available, only remaining problem is that Ctrl+C closes it

@dscho
Copy link
Member

dscho commented Jun 20, 2015

Let's continue the discussion in #205.

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

No branches or pull requests

7 participants