dongyied24121 2018-11-21 09:40
浏览 63
已采纳

如何使用bash -c启动程序,重定向/禁用该应用程序的GUI

Currently I'm starting a java application with

bash -c java -jar app.jar -config config.json

The app opens a window, displaying some output and closes. The output is also available on stdout, so I don't need (want) the GUI to display.

How can I prevent bash to forward the X output?

Follow up:

I'm running this in a go application, so based on el.pescado's answer, I have implemented this as:

func runcmd(cmd string, workdir string) ([]byte, error) {
  ex := exec.Command("bash", "-c", cmd)
  ex.Env = []string{"DISPLAY= "}
  ex.Dir = workdir
  return ex.Output()
}
  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 51单片机实训实验报告
      • ¥15 C# 循环读写数据中途突然变慢
      • ¥15 用Java实现双端队列
      • ¥150 ID3决策树实现分类
      • ¥15 multisim10安装后,找不到NI License Manager的程序来安装许可证
      • ¥15 C++银行卡系统 Help!
      • ¥15 R语言数据分析的相关问题
      • ¥15 模型导入SP后贴图纹理只有一个,拆了四张UV的,怎么解决?
      • ¥15 检索带order by 非常慢
      • ¥20 python 爬虫 token 加密方式