@@ -491,19 +491,6 @@ xy_streql_ic(const char *str1, const char *str2)
491491}
492492
493493
494- static char *
495- xy_str_to_quietcmd (const char * cmd )
496- {
497- char * ret = NULL ;
498- #ifdef _WIN32
499- ret = xy_2strcat (cmd , " >nul 2>nul " );
500- #else
501- ret = xy_2strcat (cmd , " 1>/dev/null 2>&1 " );
502- #endif
503- return ret ;
504- }
505-
506-
507494/**
508495 * @flavor Ruby: String#end_with?
509496 */
@@ -776,9 +763,23 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c
776763
777764
778765/******************************************************
779- * System
766+ * cross OS
780767 ******************************************************/
781768
769+ static char *
770+ xy_quiet_cmd (const char * cmd )
771+ {
772+ char * ret = NULL ;
773+
774+ if (xy .on_windows )
775+ ret = xy_2strcat (cmd , " >nul 2>nul " );
776+ else
777+ ret = xy_2strcat (cmd , " 1>/dev/null 2>&1 " );
778+
779+ return ret ;
780+ }
781+
782+
782783/**
783784 * @brief 执行 `cmd`,返回某行输出结果,并对已经遍历过的行执行 `func`
784785 *
@@ -845,7 +846,7 @@ xy_run (const char *cmd, unsigned long n)
845846int
846847xy_run_get_status (char * cmd )
847848{
848- char * command = xy_str_to_quietcmd (cmd );
849+ char * command = xy_quiet_cmd (cmd );
849850
850851 int status = system (command );
851852 return status ;
@@ -896,10 +897,6 @@ xy_run_get_stdout (const char *cmd, char **output)
896897}
897898
898899
899- /******************************************************
900- * cross OS
901- ******************************************************/
902-
903900 /**
904901 * @flavor 该函数同 just 中的 os_family(),只区分 windows, unix
905902 *
0 commit comments