FAQ
Hi,

I am very new to Golang and so might be doing something totally stupid
here. My goal is to start two processes (java -jar someJar.jar) and then to
  manage communication between them. The problem is that I cannot even get
started with single process and cannot seem to find something that works
for my case. Here is some code sceleton:

func main() {
consumer := exec.Command("java", "jar", "C:\\jars\\target\\my-jar.jar --a")
consumerIn, err := consumer.StdinPipe()
handleError(err)
consumerOut, err := consumer.StdoutPipe()
handleError(err)

// Start
err = consumer.Start()
handleError(err)

consumerRead := bufio.NewReader(consumerOut)
handleError(err)

line, _, err := consumerRead.ReadLine()
handleError(err)* // Error: EOF*
fmt.Println(line)

consumerIn.Write([]byte("bnbban"))

line, _, err = consumerRead.ReadLine()
fmt.Println(line)
}

Basically I am not sure if anything works here, since nothing indicates
that this is.
So just looking for some guidelines, not necessary full solution, but just
how to work with processes basically tail their output and communicate
between them.

Sorry for such non-constructive post, just that I am somewhat confused and
not sure how to specify it in more structural way.

Thanks.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 17, '14 at 5:12p
activeDec 17, '14 at 9:36p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase