是否可以取消货物中的文件锁定? [英] Is it possible to deactivate file locking in cargo?

查看:55
本文介绍了是否可以取消货物中的文件锁定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想并排运行以下命令

cargo watch "check"

cargo watch "build"

我想在后台运行cargo watch build并使用cargo watch check查看错误信息.

I want to run cargo watch build in the background and use cargo watch check to look at the error messages.

问题是cargo watch check总是在cargo watch build之后运行,然后还需要等待文件锁定

The problem is that cargo watch check always runs after cargo watch build and then also needs to wait on the file lock

cargo check
    Blocking waiting for file lock on build directory

我认为货物检查不需要文件锁.是否可以禁用货物中的文件锁定?

I don't think that a file lock would be required for cargo check. Is it possible to disable file locking in cargo?

推荐答案

我认为货物检查不需要文件锁.

I don't think that a file lock would be required for cargo check.

我可以想到一个原因:构建脚本.构建脚本可以生成包含在包中的文件,检查包而不生成文件可能会产生错误.并行运行构建脚本的 2 个实例不是一个好主意(冲突的文件写入等),因此需要锁定.

I can think of in one reason: build scripts. A build script can generate files that are included in the crate, checking the crate without generating the files would probably produce errors. Running 2 instances of a build script in parallel is not a good idea (conflicting file writes, etc), so the locking is required.

我想并排运行以下命令

您有两个选择:

  1. 顺序:安装 cargo-do 并运行

cargo watch "do check, build"

这将首先运行cargo check 然后cargo build(如果cargo check 没有发现错误).

this will first run cargo check and then cargo build (if cargo check did not find an error).

  1. 并行:更改target-dir 用于两个货物命令之一:

  1. Parallel: change the target-dir for one of the two cargo commands:

CARGO_TARGET_DIR=/tmp cargo watch check

这篇关于是否可以取消货物中的文件锁定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆