fix: when sudo enable is false, execute command will failed (#13860)

This commit is contained in:
huangxinan1990 2023-04-07 17:13:22 +08:00 committed by GitHub
parent 7e3ecfa68f
commit d772f2492b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ public class OSUtils {
* @return result of sudo execute command
*/
public static String getSudoCmd(String tenantCode, String command) {
return StringUtils.isEmpty(tenantCode) ? command : "sudo -u " + tenantCode + " " + command;
return StringUtils.isEmpty(tenantCode) || !isSudoEnable() ? command : "sudo -u " + tenantCode + " " + command;
}
/**