Giter Club home page Giter Club logo

Comments (4)

malware-unicorn avatar malware-unicorn commented on July 17, 2024

Yep I confirmed the fix, switching from StdoutPipe and StderrPipe to a custom os.Pipe() solved the output issues when in google cloud run.

I had to change the pipes in func getUsername, func (a *API) startPipes() and func (a *API) Listen and it worked out great.

Fix in my fork:
https://github.com/malware-unicorn/go-keybase-chat-bot/blob/master/kbchat/kbchat.go#L37

Also os.Pipe does not work in Windows environments so there might need to be a better work around in the future.

from go-keybase-chat-bot.

joshblum avatar joshblum commented on July 17, 2024

@malware-unicorn calling Run on the command blocks until completion, defeating the timeout in play later in the function https://github.com/malware-unicorn/go-keybase-chat-bot/blob/master/kbchat/kbchat.go#L48. In #57 I added the output pipe to ExtraFiles, are you able to get the command running with these fixes?

from go-keybase-chat-bot.

malware-unicorn avatar malware-unicorn commented on July 17, 2024

@joshblum yeah the Run is not needed but what is needed is the actual assignment for stdout because the command needs a different file descriptor since the container's stdout file descriptor is being locked/used by google cloud run's logging.

pipeR, pipeW, _ := os.Pipe()
	p.Stdout = pipeW <-------This is needed
	p.ExtraFiles = []*os.File{
		pipeW,
	}

and

scanner := bufio.NewScanner(pipeR)

Anywhere StdoutPipe is called would need to be changed to p.Stdout = pipeW

from go-keybase-chat-bot.

joshblum avatar joshblum commented on July 17, 2024

@malware-unicorn calling StdoutPipe creates a pipe, it doesn't use os.Stdout so our changes should be equivalent with the ExtraFiles call https://golang.org/src/os/exec/exec.go?s=17635:17684#L604

from go-keybase-chat-bot.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.