@@ -47,25 +47,13 @@ const pushBuildCommandOutput = function (output: string, logsArray: string[]) {
4747 logsArray . push ( output )
4848}
4949
50- const pipedPluginProcesses = new WeakMap < ChildProcess , ReturnType < typeof pipePluginOutput > > ( )
51-
5250// Start plugin step output
53- export const pipePluginOutput = function (
54- childProcess : ChildProcess ,
55- logs : Logs ,
56- standardStreams : StandardStreams ,
57- ) : LogsListeners | undefined {
58- if ( pipedPluginProcesses . has ( childProcess ) ) {
59- return pipedPluginProcesses . get ( childProcess )
51+ export const pipePluginOutput = function ( childProcess : ChildProcess , logs : Logs , standardStreams : StandardStreams ) {
52+ if ( ! logsAreBuffered ( logs ) ) {
53+ return streamOutput ( childProcess , standardStreams )
6054 }
6155
62- const listeners = ! logsAreBuffered ( logs )
63- ? streamOutput ( childProcess , standardStreams )
64- : pushOutputToLogs ( childProcess , logs , standardStreams . outputFlusher )
65-
66- pipedPluginProcesses . set ( childProcess , listeners )
67-
68- return listeners
56+ return pushOutputToLogs ( childProcess , logs , standardStreams . outputFlusher )
6957}
7058
7159// Stop streaming/buffering plugin step output
@@ -83,12 +71,10 @@ export const unpipePluginOutput = async function (
8371 }
8472
8573 unpushOutputToLogs ( childProcess , listeners . stdoutListener , listeners . stderrListener )
86-
87- pipedPluginProcesses . delete ( childProcess )
8874}
8975
9076// Usually, we stream stdout/stderr because it is more efficient
91- const streamOutput = function ( childProcess : ChildProcess , standardStreams : StandardStreams ) : undefined {
77+ const streamOutput = function ( childProcess : ChildProcess , standardStreams : StandardStreams ) {
9278 childProcess . stdout ?. pipe ( standardStreams . stdout )
9379 childProcess . stderr ?. pipe ( standardStreams . stderr )
9480}
0 commit comments