New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ability to specify hook shell #304
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #304 +/- ##
==========================================
- Coverage 85.57% 85.26% -0.32%
==========================================
Files 45 45
Lines 6380 6330 -50
==========================================
- Hits 5460 5397 -63
- Misses 920 933 +13
... and 7 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hey @zaucy, thank you for the PR. #[derive(Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(default)]
pub struct HookShell {
pub executable: String,
pub args: Vec<String>,
}
impl Default for HookShell {
fn default() -> Self {
if cfg!(windows) {
Self {
executable: "cmd.exe".to_string(),
args: vec!["/C".to_string()],
}
} else {
Self {
executable: "sh".to_string(),
args: vec!["-c".to_string()],
}
}
}
} Doing this would avoid a breaking change and setting the shell would be needed only to override the default. |
That would be better than having no support. I would prefer direct execute for all platforms. I tend to work with Windows, Linux, and macOS and direct is more consistent for me. Even tho I do believe direct execute is a better default, maybe we could add an option to do direct execute? Then |
4ce537d
to
b07425c
Compare
❌ Found 3 compliant commit and 1 non-compliant commits in 81d54be. Commit 16d1896 by @oknozor is not conform to the conventional commit specification :
|
Hey @zaucy can you squash those commits so the CI passes ? |
@oknozor done! Let me know if you'd like any changes. |
Defaults to no shell, meaning a direct execute occurs instead. This is a breaking change that would require the following to be added to
cog.toml
.I've updated the README to reflect what would need to be written if you did not specify a
shell
. As you can see not all hooks would require a shell and direct execution is just fine! (which is my main use case personally)My last pr (#283) required too many changes to the tests. This one requires a lot less.
I didn't add CI for windows, but tests are currently failing on Windows due to how the
run_cmd!
macro is being used AFAICT.