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

Comparison with popular implementations - MSBuild and File Locksmith (Powertoys) #25

Open
domsleee opened this issue Oct 23, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@domsleee
Copy link
Owner

domsleee commented Oct 23, 2023

Currently, ForceOps is using LockCheck, which is similar but it isn't the same code that is used in production by other programs.

ForceOps uses:

Restart manager does not support directories according to 1, 2.
There are two similar implementations I could find in open source that are being used by many people.

MSBuild

It uses an adapted version of LockCheck, here. MSBuildSdks also uses it here.
It uses RestartManager, so it only supports files, and not directories.

Example output:

❯ dotnet build
MSBuild version 17.6.1+8ffc3fe3d for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.302\Microsoft.Common.CurrentVersion.targets(5150,5): warning MSB3026: Coul
d not copy "C:\Users\user\myprogram\obj\Debug\net6\apphost.exe" to "bin\Debug\net6\myprogram.exe".
 Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\user\myprogram\bin\Debu
g\net6\myprogram.exe' because it is being used by another process. The file is locked by: "myprogram (1007
24)" [C:\Users\user\myprogram\myprogram.csproj]
C:\Program Files\dotnet\sdk\7.0.302\Microsoft.Common.CurrentVersion.targets(5150,5): warning MSB3026: Coul
d not copy "C:\Users\user\myprogram\obj\Debug\net6\apphost.exe" to "bin\Debug\net6\myprogram.exe".
 Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\user\myprogram\bin\Debu
g\net6\myprogram.exe' because it is being used by another process. The file is locked by: "myprogram (1007
24)" [C:\Users\user\myprogram\myprogram.csproj]
...

File Locksmith in PowerToys

File Locksmith uses NtDll, and notably uses NtQueryObject instead of NtQueryInformationFile, which LockCheck uses.

@domsleee domsleee added the documentation Improvements or additions to documentation label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant