Skip to content

fix the test #10585

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion crates/turborepo-lib/src/run/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,24 @@ impl WatchClient {
let notify_event = notify_run.clone();

let event_fut = async {
let mut first_rediscover = true;
while let Some(event) = events.next().await {
let event = event?;

// Skip the first RediscoverPackages event which is sent immediately by the
// daemon when we connect. The file watcher will send the real
// one.
if first_rediscover {
if matches!(
event.event,
Some(proto::package_change_event::Event::RediscoverPackages(_))
) {
first_rediscover = false;
continue;
}
first_rediscover = false;
}

Self::handle_change_event(&changed_packages, event.event.unwrap())?;
notify_event.notify_one();
}
Expand All @@ -200,10 +216,11 @@ impl WatchClient {
// if notify exits, then continue per usual
// if persist exits, then we break out of loop with a
select! {
_ = notify_run.notified() => {},
biased;
_ = persistent => {
break;
}
_ = notify_run.notified() => {},
}
} else {
notify_run.notified().await;
Expand Down
14 changes: 1 addition & 13 deletions turborepo-tests/integration/tests/watch/persistent-exit.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@ Disabling daemon so this matches behavior when running test on CI
web:dev: npm ERR! in workspace: web
web:dev: npm ERR! at location: .* (re)
web:dev: ERROR: command finished with error: command .*npm(?:\.cmd)? run dev exited \(1\) (re)
web#dev: command .*npm(?:\.cmd)? run dev exited \(1\) (re)
web:dev: cache bypass, force executing bfb830bdb7d49cb8
web:dev:
web:dev: > dev
web:dev: > echo server crashed && exit 1
web:dev:
web:dev: server crashed
web:dev: npm ERR! Lifecycle script `dev` failed with error:
web:dev: npm ERR! Error: command failed
web:dev: npm ERR! in workspace: web
web:dev: npm ERR! at location: .* (re)
web:dev: ERROR: command finished with error: command .*npm(?:\.cmd)? run dev exited \(1\) (re)
web#dev: command .*npm(?:\.cmd)? run dev exited \(1\) (re)
x persistent tasks exited unexpectedly

[1]
[1]
Loading