File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
packages/@apphosting/common/src Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -30,19 +30,27 @@ export async function runBuild(opts: BuildOptions = getBuildOptions()): Promise<
30
30
shell : true ,
31
31
stdio : [ "inherit" , "pipe" , "pipe" ] ,
32
32
} ) ;
33
- let buildOutput = "" ;
33
+ let stdout = "" ;
34
+ let stderr = "" ;
34
35
35
36
child . stdout . on ( "data" , ( data : Buffer ) => {
36
- buildOutput += data . toString ( ) ;
37
+ stdout += data . toString ( ) ;
37
38
} ) ;
39
+
40
+ child . stderr . on ( "data" , ( data : Buffer ) => {
41
+ stderr += data . toString ( ) ;
42
+ } ) ;
43
+
44
+ // Re-connect the child process's stdout and stderr to the console so that
45
+ // build messages and errors are still logged in Cloud Build.
46
+ child . stdout . pipe ( process . stdout ) ;
47
+ child . stderr . pipe ( process . stderr ) ;
48
+
38
49
child . on ( "exit" , ( code ) => {
39
50
if ( code !== 0 ) {
40
- reject ( new Error ( `Process exited with error code ${ code } . Output: ${ buildOutput } ` ) ) ;
41
- }
42
- if ( ! buildOutput ) {
43
- reject ( new Error ( "Unable to locate build manifest with output paths." ) ) ;
51
+ reject ( new Error ( `Build process exited with error code ${ code } .` ) ) ;
44
52
}
45
- resolve ( { stdout : buildOutput } ) ;
53
+ resolve ( { stdout : stdout , stderr : stderr } ) ;
46
54
} ) ;
47
55
} ) ;
48
56
}
You can’t perform that action at this time.
0 commit comments