feat(commit-msg): use set mode replace of chmod command
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use std::{ env, fs, process };
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
/// Git commit message format check util
|
||||
///
|
||||
@@ -108,7 +109,7 @@ fn install_commit_msg(force: bool) {
|
||||
fs::write(&git_hooks_commit_msg, commig_msg_exec_file_content).unwrap_or_else(|e| {
|
||||
exit_with_error_message(&format!("Write file: {:?} failed: {}.", git_hooks_commit_msg, e));
|
||||
});
|
||||
Command::new("chmod").args(&["+x", git_hooks_commit_msg.to_str().unwrap()]).output().unwrap_or_else(|e| {
|
||||
fs::set_permissions(&git_hooks_commit_msg, PermissionsExt::from_mode(0o755)).unwrap_or_else(|e| {
|
||||
exit_with_error_message(&format!("Apply executable permission on file: {:?} failed: {}.", git_hooks_commit_msg, e));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user