File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,6 +307,8 @@ pub trait LanguagePlugin: Send + Sync {
307307 }
308308
309309 fn execute_cross_platform_command ( & self , command : & str ) -> Result < ( ) , String > {
310+ info ! ( "执行命令: {}" , command) ;
311+
310312 let output = if cfg ! ( target_os = "windows" ) {
311313 std:: process:: Command :: new ( "cmd" )
312314 . args ( [ "/C" , command] )
@@ -319,11 +321,26 @@ pub trait LanguagePlugin: Send + Sync {
319321
320322 let output = output. map_err ( |e| format ! ( "执行命令失败: {}" , e) ) ?;
321323
324+ debug ! ( "命令退出状态: {:?}" , output. status) ;
325+ debug ! ( "命令标准输出: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
326+ debug ! ( "命令标准错误: {}" , String :: from_utf8_lossy( & output. stderr) ) ;
327+
322328 if !output. status . success ( ) {
323- return Err ( format ! (
324- "命令执行失败: {}" ,
325- String :: from_utf8_lossy( & output. stderr)
326- ) ) ;
329+ let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
330+ let stdout = String :: from_utf8_lossy ( & output. stdout ) ;
331+
332+ let error_msg = if !stderr. is_empty ( ) {
333+ stderr. to_string ( )
334+ } else if !stdout. is_empty ( ) {
335+ stdout. to_string ( )
336+ } else {
337+ format ! (
338+ "命令执行失败,退出代码: {}" ,
339+ output. status. code( ) . unwrap_or( -1 )
340+ )
341+ } ;
342+
343+ return Err ( format ! ( "命令执行失败: {}" , error_msg) ) ;
327344 }
328345
329346 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ export function useCodeMirrorEditor(props: Props)
184184 return StreamLanguage . define ( clojure )
185185 case 'ruby' :
186186 return StreamLanguage . define ( ruby )
187+ case 'typescript' :
187188 case 'typescript-nodejs' :
188189 return javascript ( { typescript : true } )
189190 default :
You can’t perform that action at this time.
0 commit comments