Opened 13 months ago

Last modified 24 hours ago

#25613 needs_review enhancement

Close child's stdout to signal exit in meek-client-torbrowser

Reported by: dcf Owned by: dcf
Priority: Low Milestone:
Component: Obfuscation/meek Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Moved from #24642.

Another (possibly better) option is to call cmd.StdinPipe() and just never close the pipe (that way the child process's stdin is separate from the parent's, so you don't have a race between them trying to terminate when the stdin is closed).

The bug24642 branch uses the StdinPipe idea.

I'm not totally happy with it, because ideally according to pt-spec, we should keep track of the stdin handle, and close it before sending anything like SIGTERM to the subprocess. But that would require more rewriting and is more than you need right now.

Child Tickets

Change History (1)

comment:1 Changed 24 hours ago by dcf

Status: newneeds_review

Branch bug25613 refactors the way that meek-client-torbrowser handles its client processes.

This is the commit that touches meek-client. We get a handle to the child's stdin:

// ptCmd is a *exec.Cmd augmented with an io.WriteCloser for its stdin, which we
// can close to instruct the PT subprocess to terminate.
type ptCmd struct {
	StdinCloser io.WriteCloser

then close it as the first step of terminating the process.

	err := cmd.StdinCloser.Close()
Note: See TracTickets for help on using tickets.