@@ -594,11 +594,29 @@ def jupyterlite_build(app: Sphinx, error):
594594 [isinstance (s , str ) for s in command ]
595595 ), f"Expected all commands arguments to be a str, got { command } "
596596
597- kwargs = {"cwd" : app .srcdir , "check" : True }
597+ kwargs = {"cwd" : app .srcdir , "check" : False }
598598 if app .env .config .jupyterlite_silence :
599- kwargs ["stdout" ] = subprocess .DEVNULL
600- kwargs ["stderr" ] = subprocess .DEVNULL
601- subprocess .run (command , ** kwargs )
599+ kwargs ["stdout" ] = subprocess .PIPE
600+ kwargs ["stderr" ] = subprocess .PIPE
601+
602+ completed_process = subprocess .run (command , ** kwargs )
603+
604+ if completed_process .returncode != 0 :
605+ if app .env .config .jupyterlite_silence :
606+ print (
607+ "`jupyterlite build` failed but it's output has been silenced."
608+ " stdout and stderr are reproduced below.\n "
609+ )
610+ print ("stdout:" , completed_process .stdout .decode ())
611+ print ("stderr:" , completed_process .stderr .decode ())
612+
613+ # Raise the original exception that would have occurred with check=True
614+ raise subprocess .CalledProcessError (
615+ returncode = completed_process .returncode ,
616+ cmd = command ,
617+ output = completed_process .stdout ,
618+ stderr = completed_process .stderr ,
619+ )
602620
603621 print ("[jupyterlite-sphinx] JupyterLite build done" )
604622
0 commit comments