Skip to content

Commit

Permalink
fix: ignore clear cmd error
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoliveira committed Jun 29, 2024
1 parent 5831073 commit 7e2e57a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
8 changes: 7 additions & 1 deletion .watch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
- name: run my test (tag:quick)
run:
- "make tests"
- "cargo test --verbose"
# - 'cargo test it_returns_an_error_when_fail_to_load_config_file -- --nocapture'
change: "src/**"
run_on_init: true
Expand All @@ -19,6 +19,12 @@
change: "src/**"
ignore: "src/**/*log*"

- name: run new-integration (tag:quick)
run:
- "cargo test --test '*' -- --nocapture"
change: "tests/**/*.rs"
run_on_init: true

- name: run integration
run: "make testpath={{filepath}} integration"
change: "tests/integration/**/*.sh"
Expand Down
4 changes: 1 addition & 3 deletions src/cli/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ impl Command for WatchCommand {
watcher::events(
|file_changed| {
if let Some(rules) = self.watches.watch(file_changed) {
if let Err(err) = cmd::execute(&"clear".to_owned()) {
stdout::error(&format!("failed to clear screen: {:?}", err));
}
let _ = cmd::execute(&"clear".to_owned());

stdout::verbose(
&format!("Triggered by change in: {}", file_changed),
Expand Down
4 changes: 1 addition & 3 deletions src/cli/watch_non_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ impl Command for WatchNonBlockCommand {
watcher::events(
|file_changed| {
if let Some(rules) = self.watches.watch(file_changed) {
if let Err(err) = cmd::execute(&"clear".to_owned()) {
stdout::error(&format!("failed to clear screen: {:?}", err));
}
let _ = cmd::execute(&"clear".to_owned());

stdout::verbose(
&format!("Triggered by change in: {}", file_changed),
Expand Down
7 changes: 2 additions & 5 deletions tests/watching_files_change_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ fn test_it_is_not_triggered_by_ignored_files() {

sleep(Duration::from_secs(2));

assert_eq!(
output.replace(clear_char, ""),
""
);
assert_eq!(output.replace(clear_char, ""), "");
}

#[test]
Expand All @@ -183,7 +180,7 @@ fn test_it_watches_a_list_of_tasks_and_do_not_panic() {

defer!({
child.kill().expect("failed to kill child");
// let _ = std::fs::remove_file(dir.join(test_log));
let _ = std::fs::remove_file(dir.join(test_log));
});

let mut output = String::new();
Expand Down

0 comments on commit 7e2e57a

Please sign in to comment.