添加 xy_run_get_status()

This commit is contained in:
Aoran Zeng 2025-08-27 14:50:11 +08:00
parent 4cffe05711
commit afc4ba3d06
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -839,11 +839,25 @@ xy_run (const char *cmd, unsigned long n)
}
/**
* @brief
*/
int
xy_run_get_status (char *cmd)
{
char * command = xy_str_to_quietcmd (cmd);
int status = system (command);
return status;
}
/**
* @brief
*
* @param[in] cmd
* @param[out] output
* @param[out] output
* NULL时表示不关心stdout输出stderr输出
*
* @return
*/
@ -874,7 +888,10 @@ xy_run_capture (const char *cmd, char **output)
buf[size] = '\0';
int status = pclose (stream);
if (output)
*output = buf;
return status;
}