File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -207,11 +207,12 @@ When("I type {string}", function (userInput) {
207207
208208When ( "I press Enter" , function ( ) {
209209 return new Promise < void > ( ( resolve ) => {
210- this . childProcess . stdin . write ( "\n" ) ;
211- this . childProcess . stdin . end ( ) ;
212210 this . childProcess . on ( "close" , ( ) => {
213211 resolve ( ) ;
214212 } ) ;
213+
214+ this . childProcess . stdin . write ( "\n" ) ;
215+ this . childProcess . stdin . end ( ) ;
215216 } ) ;
216217} ) ;
217218
Original file line number Diff line number Diff line change @@ -114,21 +114,27 @@ export class OurWorld extends World {
114114 } ,
115115 ) ;
116116
117- let stdout : Buffer ;
118- let stderr : Buffer ;
117+ const stdoutChunks : Buffer [ ] = [ ] ;
118+ const stderrChunks : Buffer [ ] = [ ] ;
119119
120120 this . childProcess . stdout . on ( "data" , ( data : Buffer ) => {
121- stdout = data ;
121+ stdoutChunks . push ( data ) ;
122122 } ) ;
123123
124124 this . childProcess . stderr . on ( "data" , ( data : Buffer ) => {
125- stderr = data ;
125+ stderrChunks . push ( data ) ;
126126 } ) ;
127127
128128 this . childProcess . on ( "exit" , ( code : number ) => {
129129 this . response = {
130- stdout : stdout ?? Buffer . from ( "" ) ,
131- stderr : stderr ?? Buffer . from ( "" ) ,
130+ stdout :
131+ stdoutChunks . length > 0
132+ ? Buffer . concat ( stdoutChunks )
133+ : Buffer . from ( "" ) ,
134+ stderr :
135+ stderrChunks . length > 0
136+ ? Buffer . concat ( stderrChunks )
137+ : Buffer . from ( "" ) ,
132138 status : code ,
133139 } ;
134140 } ) ;
You can’t perform that action at this time.
0 commit comments