如何分离"git gui"从"Git bash"开始在Windows上? [英] How to detach "git gui" started in "Git bash" on Windows?

查看:185
本文介绍了如何分离"git gui"从"Git bash"开始在Windows上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,

  1. 我开始"git bash";
  2. 我将导航到certian目录;
  3. 我开始git gui&;
  4. 我关闭控制台窗口或按Ctrl + C.
  1. I start "git bash";
  2. I navitage to certian directory;
  3. I start git gui&;
  4. I close the console window or press Ctrl+C.

Git-gui的窗口消失了.即使我使用了git gui&disown.即使当我按Ctrl + C时它不在前台.

Git-gui's window disappears. Even if I used git gui&disown. Even if it is not in foreground when I pressed Ctrl+C.

如何从Windows控制台正确分离git gui?

How to properly detach git gui from Windows console?

推荐答案

为了使其他人受益,我将给出与 msys bash .

To the benefit of the others I will give a more general answer related to both git bash and msys bash.

假设您要分离应用程序:

Assume you want to detach the app:

"C:\Program Files\MyApp\MyApp.exe"

不会将您要检索的任何信息输出到stdout(或stderr).
在Windows bash shell中使用:

which does not output any info you want to retrieve to stdout (or stderr).
use in your Windows bash shell:

cmd //c start //D "C:\\Program Files\\MyApp"  MyApp.exe arg1 arg2 

MyApp将在单独的窗口中运行,并且关闭正在调用的bash shell不会对其产生影响(大体上类似于Linux守护程序).

MyApp will run in a separate window and closing the calling bash shell will not affect it (by and large like a Linux daemon).

如前所述,除非它们是对话消息,否则您将无法阅读它们,因此此解决方案适用于GUI应用程序.无论如何,如果MyApp.exe是Windows批处理文件(例如MyApp.cmd),它将调用其cmd.exe主机并登录到该主机:简而言之,您将读取.cmd/.bat情况的输出.

As noted, you can't read app messages unless they are dialog messages, therefore this solution fits to GUI applications. Anyway, if MyApp.exe is instead a Windows batch file like MyApp.cmd, it will call its cmd.exe host and log there: in short you will read outputs for the .cmd/.bat case.

类似Mac的用户

cmd.exe窗口将立即闪烁.如果这对您(用户)不那么酷,请在上一行中将cmd替换为 cmdow NirCmd 之类的.

The cmd.exe window will flash-out for an instant. If this is not such cool for you(r users), in the above line replace cmd with cmdow, NirCmd or the likes.

如果您想将日志读取到stdout和stderr,请使用:

If you want to read logs to stdout and stderr, use:

cmd //c start cmd //k  "C:\\Program Files\\MyApp\\MyApp" arg1 arg2 

如果MyApp是控制台应用程序,则通常建议使用此替代方法.现在,您将获得一个带有"home"的守护程序. MyApp将在第二个cmd.exe托管下运行,您将在此处看到其输出.
对于GUI应用程序,您最终有两个窗口:MyApp窗口和调用cmd窗口.

This alternative is mostly advised if MyApp is a console application. Now you get a daemon with a "home". MyApp will run hosted by the second cmd.exe and you will see here its output.
For a GUI app you end out with two windows: MyApp window and the calling cmd window.

在这两种情况下,退出MyApp并不意味着关闭cmd窗口.关闭cmd窗口只会关闭MyApp控制台.

In both cases, exiting MyApp doesn't mean closing the cmd window; while closing the cmd window will only close MyApp console.

如果闪烁的拳头击中了您,则这里您只需要替换第一个cmd,第二个是您守护程序的可移动的家.

If the flashing punch strikes you, here you only need to replace the first cmd, the second is your daemon's visbile home.

某些文件通过类似于Linux shebang语法但基于Windows注册表的机制与某些处理应用程序紧密相关.因此您无需调用相关应用程序即可打开文档.

Some documents are closely related to some processing applications, via a mechanism resembling the Linux shebang syntax, but based on Windows' registry; so you open the document without calling the related application.

这种行为可以用bash甚至是分离的样式来模拟.

This behaviour can be emulated in bash and even in a detached style.

对于不需要输出到stdout和stderr的应用程序,请使用以下命令打开MyApp.doc:

As for apps not needing to output to stdout and stderr, opening MyApp.doc with:

cmd //c start //D "C:\\Program Files\\MyApp"  MyApp.exe  "Path\\to\\MyApp.doc"

可以简化为:

cmd //c start //D "Path\\to" MyApp.doc

对于需要stdout和stderr输出的应用程序,

As for apps needing stdout and stderr output,

cmd //c start cmd //k  "C:\\Program Files\\MyApp\\MyApp" "Path\\to\\MyApp.doc"

可以简化为:

cmd //c start cmd //k  "Path\\to\\MyApp.doc"

这篇关于如何分离"git gui"从"Git bash"开始在Windows上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆