Skip to content
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

Fix watchexec missing files in subdirectories #1983

Merged
merged 1 commit into from
Oct 30, 2023
Merged
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
2 changes: 2 additions & 0 deletions src/commands/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{
use anyhow::{Context, Result};
use clap::Parser;
use itertools::Itertools;
use path_absolutize::Absolutize;
use spin_common::paths::parent_dir;
use uuid::Uuid;
use watchexec::Watchexec;
Expand Down Expand Up @@ -93,6 +94,7 @@ impl WatchCommand {

let spin_bin = std::env::current_exe()?;
let manifest_file = spin_common::paths::resolve_manifest_file_path(&self.app_source)?;
let manifest_file = manifest_file.absolutize()?.to_path_buf(); // or watchexec misses files in subdirectories
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUT WHY

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BECAUSE REASONS LANN REASONS

We could probably absolutise at the last moment before we pass the directory to watchexec - I just get paranoid about capturing the true location as early as possible (a) so I don't need to remember to do it at all the last moments and (b) in case some other piece of code sneakily switches out the current directory from underneath me. thousand yard stare

We can iterate on this for sure though.

let manifest_dir = parent_dir(&manifest_file)?;

// Set up the event processors (but don't start them yet).
Expand Down