[tor-commits] [meek/extension] Don't inherit stdin.
dcf at torproject.org
dcf at torproject.org
Tue Apr 8 08:30:16 UTC 2014
commit e4c566c24041d22d869485c104f06e9ddd0ff5d8
Author: David Fifield <david at bamsoftware.com>
Date: Tue Apr 8 00:40:58 2014 -0700
Don't inherit stdin.
---
processterminate-buffer/main.go | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/processterminate-buffer/main.go b/processterminate-buffer/main.go
index cb68ee4..05d586d 100644
--- a/processterminate-buffer/main.go
+++ b/processterminate-buffer/main.go
@@ -8,6 +8,7 @@
package main
import (
+ "io"
"log"
"os"
"os/exec"
@@ -19,13 +20,17 @@ func main() {
log.Fatalf("%s needs a command to run", os.Args[0])
}
cmd := exec.Command(args[0], args[1:]...)
- cmd.Stdin = os.Stdin
+ stdin, err := cmd.StdinPipe()
+ if err != nil {
+ log.Fatal(err)
+ }
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
- err := cmd.Start()
+ err = cmd.Start()
if err != nil {
log.Fatal(err)
}
+ io.Copy(stdin, os.Stdin)
err = cmd.Wait()
if err != nil {
log.Fatal(err)
More information about the tor-commits
mailing list