-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Currently, the build script is used to perform local setup when rusty-hook
is leveraged as a dev dependency to simplify and automated the hook setup process.
Our build script always exits with 0 even when the initialization process fails with an accompanying error message printed.
Lines 14 to 25 in b90df24
if let Err(err) = rusty_hook::init_directory( | |
nias::get_command_runner(), | |
nias::get_file_writer(), | |
nias::get_file_existence_checker(), | |
Some(&target_directory), | |
) { | |
println!( | |
"Fatal error encountered during initialization. Details: {}", | |
err | |
); | |
}; | |
exit(0); |
However, cargo doesn't display any output from build scripts unless invoked with the -vv
flag which shouldn't be a requirement (it is by definition very vebose 😉).
I'm not really sure why we did it this way, probably an attempt to avoid any failures during the initial cargo test
run, but it's problematic because the initialization will just silently fail in the event of any init issues which makes for a poor user experience (refs #109).
We should just have the build script exit properly when initialization fails so that the output is displayed. Users can always remove rusty-hook
from their dev-deps if it becomes a blocking issue for them
This could be fixed with something as simple as the following:
if let Err(err) = rusty_hook::init_directory(
nias::get_command_runner(),
nias::get_file_writer(),
nias::get_file_existence_checker(),
Some(&target_directory),
) {
eprintln!(
"\n[rusty-hook]: Fatal error encountered during initialization. Details: {}\n",
err
);
exit(1);
};
exit(0);