Settle the situation that busybox cp has no --version

[GitHub #152]
This commit is contained in:
Aoran Zeng 2024-12-14 18:09:45 +08:00
parent 6ded3380e5
commit d4ab7e0ec6
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -1284,7 +1284,14 @@ chsrc_backup (const char *path)
}
else
{
char *ver = xy_run (xy_str_to_quietcmd ("cp --version"), 1);
/**
* @see https://github.com/RubyMetric/chsrc/issues/152#issuecomment-2542673273
*
* busybox cp stderr unrecognized option: version
* stderr stdout便 xy_run()
*
*/
char *ver = xy_run ("cp --version 2>&1", 1);
/* cp (GNU coreutils) 9.4 */
if (strstr (ver, "GNU coreutils"))
{