Skip to main content
added 332 characters in body; edited tags
Source Link
G-M
  • 356
  • 1
  • 7
  • 16

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()
}

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?

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()
}
Source Link
G-M
  • 356
  • 1
  • 7
  • 16

How to start a program with bash -c, redirect / disable GUI of that app

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?