Skip to content
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
6 changes: 3 additions & 3 deletions crates/fspy/src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>
let supervisor = supervise::<SyscallHandler>()?;

#[cfg(target_os = "linux")]
let mut supervisor_pre_exec = supervisor.pre_exec;
let supervisor_pre_exec = supervisor.pre_exec;

let payload = Payload {
ipc_fd: shm_fd_sender.as_raw_fd(),
Expand All @@ -201,7 +201,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>

let mut exec = command.get_exec();
let mut exec_resolve_accesses = PathAccessArena::default();
let mut pre_exec = handle_exec(
let pre_exec = handle_exec(
&mut exec,
ExecResolveConfig::search_path_enabled(None),
&encoded_payload,
Expand All @@ -221,7 +221,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>

#[cfg(target_os = "linux")]
supervisor_pre_exec.run()?;
if let Some(pre_exec) = &mut pre_exec {
if let Some(pre_exec) = pre_exec.as_ref() {
pre_exec.run()?;
}
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn handle_exec(
global_client().expect("exec unexpectedly called before client initialized in ctor");
let result = unsafe {
client.handle_exec(config, RawExec { prog, argv, envp }, |raw_command, pre_exec| {
if let Some(mut pre_exec) = pre_exec {
if let Some(pre_exec) = pre_exec {
pre_exec.run()?
};
Ok(execve::original()(raw_command.prog, raw_command.argv, raw_command.envp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ unsafe fn handle_posix_spawn(
raw_command.envp.cast(),
)
};
if let Some(mut pre_exec) = pre_exec {
if let Some(pre_exec) = pre_exec {
thread::scope(move |s| {
let call_original = AssertSend(call_original);
s.spawn(move || {
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_seccomp_unotify/src/supervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Supervisor<F> {

pub struct PreExec(OwnedFd);
impl PreExec {
pub fn run(&mut self) -> nix::Result<()> {
pub fn run(&self) -> nix::Result<()> {
let mut fd_flag = FdFlag::from_bits_retain(fcntl(&self.0, FcntlArg::F_GETFD)?);
fd_flag.remove(FdFlag::FD_CLOEXEC);
fcntl(&self.0, FcntlArg::F_SETFD(fd_flag))?;
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_seccomp_unotify/tests/arg_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async fn run_in_pre_exec(
) -> Result<Vec<Syscall>, Box<dyn Error>> {
Ok(timeout(Duration::from_secs(5), async move {
let mut cmd = Command::new("/bin/echo");
let Supervisor { payload, handling_loop, mut pre_exec } = supervise::<SyscallRecorder>()?;
let Supervisor { payload, handling_loop, pre_exec } = supervise::<SyscallRecorder>()?;

unsafe {
cmd.pre_exec(move || {
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_shared_unix/src/spawn/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LD_PRELOAD: &str = "LD_PRELOAD";

pub struct PreExec(SeccompPayload);
impl PreExec {
pub fn run(&mut self) -> nix::Result<()> {
pub fn run(&self) -> nix::Result<()> {
install_target(&self.0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_shared_unix/src/spawn/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{

pub struct PreExec(Infallible);
impl PreExec {
pub fn run(&mut self) -> nix::Result<()> {
pub fn run(&self) -> nix::Result<()> {
match self.0 {}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl TaskCache {
}

pub async fn update(
&mut self,
&self,
resolved_task: &ResolvedTask,
cached_task: CommandCacheValue,
) -> Result<(), Error> {
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{

pub async fn doc<Doc: Future<Output = Result<ResolveCommandResult, Error>>, DocFn: Fn() -> Doc>(
resolve_doc_command: DocFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task =
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct FmtConfig {
#[tracing::instrument(skip(resolve_fmt_command, workspace))]
pub async fn fmt<Fmt: Future<Output = Result<ResolveCommandResult, Error>>, FmtFn: Fn() -> Fmt>(
resolve_fmt_command: FmtFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task =
Expand Down
4 changes: 2 additions & 2 deletions crates/vite_task/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl InstallCommand {
}
Err(e) => return Err(e),
};
let mut workspace = Workspace::partial_load(self.workspace_root)?;
let workspace = Workspace::partial_load(self.workspace_root)?;
let resolve_command = package_manager.resolve_command();
let resolved_task = ResolvedTask::resolve_from_builtin_with_command_result(
&workspace,
Expand All @@ -69,7 +69,7 @@ impl InstallCommand {
)?;
let mut task_graph: StableGraph<ResolvedTask, ()> = Default::default();
task_graph.add_node(resolved_task);
let summary = ExecutionPlan::plan(task_graph, false)?.execute(&mut workspace).await?;
let summary = ExecutionPlan::plan(task_graph, false)?.execute(&workspace).await?;
workspace.unload().await?;

Ok(summary)
Expand Down
32 changes: 16 additions & 16 deletions crates/vite_task/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub async fn main<
} else {
recursive_run
};
let mut workspace = Workspace::load(cwd, topological_run)?;
let workspace = Workspace::load(cwd, topological_run)?;

let task_graph = workspace.build_task_subgraph(
tasks,
Expand All @@ -324,12 +324,12 @@ pub async fn main<
)?;

let plan = ExecutionPlan::plan(task_graph, parallel_run)?;
let summary = plan.execute(&mut workspace).await?;
let summary = plan.execute(&workspace).await?;
workspace.unload().await?;
summary
}
Commands::Lint { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let lint_fn = options
.as_ref()
.map(|o| &o.lint)
Expand All @@ -356,58 +356,58 @@ pub async fn main<
oxlint_config_path.as_path().to_string_lossy().into_owned(),
]);
}
let summary = lint::lint(lint_fn, &mut workspace, args).await?;
let summary = lint::lint(lint_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Fmt { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let fmt_fn =
options.map(|o| o.fmt).expect("fmt command requires CliOptions to be provided");

let summary = fmt::fmt(fmt_fn, &mut workspace, args).await?;
let summary = fmt::fmt(fmt_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Build { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let vite_fn =
options.map(|o| o.vite).expect("build command requires CliOptions to be provided");

let summary = vite::create_vite("build", vite_fn, &mut workspace, args).await?;
let summary = vite::create_vite("build", vite_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Test { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let test_fn =
options.map(|o| o.test).expect("test command requires CliOptions to be provided");
let summary = test::test(test_fn, &mut workspace, args).await?;
let summary = test::test(test_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Lib { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let lib_fn =
options.map(|o| o.lib).expect("lib command requires CliOptions to be provided");
let summary = lib_cmd::lib(lib_fn, &mut workspace, args).await?;
let summary = lib_cmd::lib(lib_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Install { args } => {
install::InstallCommand::builder(cwd).build().execute(args).await?
}
Commands::Dev { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let vite_fn = options.map(|o| o.vite).expect("dev command requires CliOptions");
let summary = vite::create_vite("dev", vite_fn, &mut workspace, args).await?;
let summary = vite::create_vite("dev", vite_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Commands::Doc { args } => {
let mut workspace = Workspace::partial_load(cwd)?;
let workspace = Workspace::partial_load(cwd)?;
let doc_fn = options.map(|o| o.doc).expect("doc command requires CliOptions");
let summary = doc::doc(doc_fn, &mut workspace, args).await?;
let summary = doc::doc(doc_fn, &workspace, args).await?;
workspace.unload().await?;
summary
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/lib_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
#[tracing::instrument(skip(resolve_lib_command, workspace))]
pub async fn lib<Lib: Future<Output = Result<ResolveCommandResult, Error>>, LibFn: Fn() -> Lib>(
resolve_lib_command: LibFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task =
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn lint<
LintFn: Fn() -> Lint,
>(
resolve_lint_command: LintFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task =
Expand Down
8 changes: 4 additions & 4 deletions crates/vite_task/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl ExecutionPlan {
/// - `Ok(ExecutionSummary)` containing execution status of all tasks (some may fail with non-zero exit code)
/// - `Err(_)` for other errors (network, filesystem, etc.)
#[tracing::instrument(skip(self, workspace))]
pub async fn execute(self, workspace: &mut Workspace) -> Result<ExecutionSummary, Error> {
pub async fn execute(self, workspace: &Workspace) -> Result<ExecutionSummary, Error> {
let mut execution_statuses = Vec::<ExecutionStatus>::with_capacity(self.steps.len());
for step in self.steps {
execution_statuses.push(Self::execute_resolved_task(step, workspace).await?);
Expand All @@ -135,7 +135,7 @@ impl ExecutionPlan {

async fn execute_resolved_task(
step: ResolvedTask,
workspace: &mut Workspace,
workspace: &Workspace,
) -> anyhow::Result<ExecutionStatus> {
tracing::debug!("Executing task {}", step.display_name());
let display_options = step.display_options;
Expand All @@ -146,7 +146,7 @@ impl ExecutionPlan {
let (cache_status, execute_or_replay) = get_cached_or_execute(
&execution_id,
step.clone(),
&mut workspace.task_cache,
&workspace.task_cache,
&workspace.fs,
&workspace.workspace_dir,
)
Expand Down Expand Up @@ -183,7 +183,7 @@ impl ExecutionPlan {
async fn get_cached_or_execute<'a>(
execution_id: &'a str,
task: ResolvedTask,
cache: &'a mut TaskCache,
cache: &'a TaskCache,
fs: &'a impl FileSystem,
base_dir: &'a AbsolutePath,
) -> Result<(CacheStatus, BoxFuture<'a, Result<ExitStatus, Error>>), Error> {
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub async fn test<
TestFn: Fn() -> Test,
>(
resolve_test_command: TestFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task = ResolvedTask::resolve_from_builtin(
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/vite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub async fn create_vite<
>(
arg_forward: &str,
resolve_vite_command: ViteFn,
workspace: &mut Workspace,
workspace: &Workspace,
args: &Vec<String>,
) -> Result<ExecutionSummary, Error> {
let resolved_task = ResolvedTask::resolve_from_builtin(
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl App {
Ok(())
}

async fn handle_events(&mut self, tui: &mut Tui) -> Result<()> {
async fn handle_events(&self, tui: &mut Tui) -> Result<()> {
let Some(event) = tui.next_event().await else {
return Ok(());
};
Expand Down
Loading