|
Line 0
Link Here
|
|
|
1 |
--- helper/wrappedstreams/streams.go.orig 2020-07-25 03:39:12 UTC |
| 2 |
+++ helper/wrappedstreams/streams.go |
| 3 |
@@ -10,32 +10,31 @@ import ( |
| 4 |
|
| 5 |
// Stdin returns the true stdin of the process. |
| 6 |
func Stdin() *os.File { |
| 7 |
- stdin := os.Stdin |
| 8 |
- if panicwrap.Wrapped(nil) { |
| 9 |
- stdin = wrappedStdin |
| 10 |
- } |
| 11 |
- |
| 12 |
+ stdin, _, _ := fds() |
| 13 |
return stdin |
| 14 |
} |
| 15 |
|
| 16 |
// Stdout returns the true stdout of the process. |
| 17 |
func Stdout() *os.File { |
| 18 |
- stdout := os.Stdout |
| 19 |
- if panicwrap.Wrapped(nil) { |
| 20 |
- stdout = wrappedStdout |
| 21 |
- } |
| 22 |
- |
| 23 |
+ _, stdout, _ := fds() |
| 24 |
return stdout |
| 25 |
} |
| 26 |
|
| 27 |
// Stderr returns the true stderr of the process. |
| 28 |
func Stderr() *os.File { |
| 29 |
- stderr := os.Stderr |
| 30 |
+ _, _, stderr := fds() |
| 31 |
+ return stderr |
| 32 |
+} |
| 33 |
+ |
| 34 |
+func fds() (stdin, stdout, stderr *os.File) { |
| 35 |
+ stdin, stdout, stderr = os.Stdin, os.Stdout, os.Stderr |
| 36 |
+ |
| 37 |
if panicwrap.Wrapped(nil) { |
| 38 |
- stderr = wrappedStderr |
| 39 |
+ initPlatform() |
| 40 |
+ stdin, stdout, stderr = wrappedStdin, wrappedStdout, wrappedStderr |
| 41 |
} |
| 42 |
|
| 43 |
- return stderr |
| 44 |
+ return |
| 45 |
} |
| 46 |
|
| 47 |
// These are the wrapped standard streams. These are setup by the |
| 48 |
@@ -45,8 +44,3 @@ var ( |
| 49 |
wrappedStdout *os.File |
| 50 |
wrappedStderr *os.File |
| 51 |
) |
| 52 |
- |
| 53 |
-func init() { |
| 54 |
- // Initialize the platform-specific code |
| 55 |
- initPlatform() |
| 56 |
-} |