@@ -7,7 +7,7 @@ use libcnb::{build::BuildContext, layer::UncachedLayerDefinition};
77use libherokubuildpack:: log:: log_info;
88use static_web_server_utils:: read_project_config;
99use std:: fs;
10- use std:: process:: { Command , Output } ;
10+ use std:: process:: { Command , Stdio } ;
1111use toml:: Table ;
1212
1313pub ( crate ) fn config_web_server (
@@ -40,26 +40,18 @@ pub(crate) fn config_web_server(
4040 . map_err ( StaticWebServerBuildpackError :: CannotWriteCaddyConfiguration ) ?;
4141
4242 // Execute the optional build command
43- build_command_opt. map ( |e| -> Result < Output , StaticWebServerBuildpackError > {
44- log_info ( format ! ( "Executing build command: {e:#?}" ) ) ;
45- let mut cmd = Command :: new ( e. command . clone ( ) ) ;
46- e. args . clone ( ) . map ( |v| cmd. args ( v) ) ;
47- let output = cmd
43+ if let Some ( build_command) = build_command_opt {
44+ log_info ( format ! ( "Executing build command: {build_command:#?}" ) ) ;
45+ let mut cmd = Command :: new ( build_command. command ) ;
46+ if let Some ( args) = build_command. args {
47+ cmd. args ( args) ;
48+ }
49+
50+ cmd. stdout ( Stdio :: inherit ( ) )
51+ . stderr ( Stdio :: inherit ( ) )
4852 . output ( )
4953 . map_err ( StaticWebServerBuildpackError :: BuildCommandFailed ) ?;
50-
51- log_info ( format ! ( "status: {}" , output. status) ) ;
52- log_info ( format ! (
53- "stdout: {}" ,
54- String :: from_utf8_lossy( & output. stdout)
55- ) ) ;
56- log_info ( format ! (
57- "stderr: {}" ,
58- String :: from_utf8_lossy( & output. stderr)
59- ) ) ;
60-
61- Ok ( output)
62- } ) ;
54+ }
6355
6456 Ok ( configuration_layer)
6557}
0 commit comments