File tree Expand file tree Collapse file tree 1 file changed +16
-19
lines changed
packages/build/src/extensions Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -124,28 +124,25 @@ export const run = async (
124124) : Promise < Result > => {
125125 const pythonBin = process . env . PYTHON_BIN_PATH || "python" ;
126126
127- const result = await x ( pythonBin , scriptArgs , {
128- ...options ,
129- throwOnError : false , // Ensure errors are handled manually
130- } ) ;
131-
132- try {
133- assert (
134- result . exitCode === 0 ,
135- `Python command exited with non-zero code ${ result . exitCode } \nStdout: ${ result . stdout } \nStderr: ${ result . stderr } `
136- ) ;
137- } catch ( error ) {
138- logger . error ( "Python command execution failed" , {
139- error : error instanceof Error ? error . message : error ,
127+ return await logger . trace ( "Python call" , async ( span ) => {
128+ span . addEvent ( "Properties" , {
140129 command : `${ pythonBin } ${ scriptArgs . join ( " " ) } ` ,
141- stdout : result . stdout ,
142- stderr : result . stderr ,
143- exitCode : result . exitCode ,
144130 } ) ;
145- throw error ;
146- }
147131
148- return result ;
132+ const result = await x ( pythonBin , scriptArgs , {
133+ ...options ,
134+ throwOnError : false , // Ensure errors are handled manually
135+ } ) ;
136+
137+ span . addEvent ( "Output" , { ...result } ) ;
138+
139+ if ( result . exitCode !== 0 ) {
140+ logger . error ( result . stderr , { ...result } ) ;
141+ throw new Error ( `Python command exited with non-zero code ${ result . exitCode } ` ) ;
142+ }
143+
144+ return result ;
145+ } ) ;
149146} ;
150147
151148export const runScript = (
You can’t perform that action at this time.
0 commit comments