Skip to content

Conversation

@KevinRansom
Copy link
Contributor

Fixes #12140 - Fsc deletes the output directory
Fixes #11923 - FSI fails with "error FS3217: No such file or directory"

Additionally, this makes working directory evaluation lazy ... so it doesn't touch the disk unless nuget evaluation is actually required.

#12140 - Fsc deletes the output directory
The output directory deletion was because, we pass the directory from --out: to the package manager, the pm intended to create use and delete a subdirectory from that, however, due to a bug it didn't. Instead it used the directory from --out: and tried to delete that.

Fixes #11923 - FSI fails with "error FS3217: No such file or directory"
This failed because when no directory is specified the package manager created a directory in the temp directory named nuget/Some randomized directory name.

On linux, if the tempdir/nuget had been created by a different user, e.g. the sudo admin user, then subsequent scri0pts not run with that user would fail.

This modification simply eliminates the common part of the path. So the script should be able to write using whatever user is executing the code.

if Directory.Exists(workingDirectory) then
Directory.Delete(workingDirectory, true)
#if !DEBUG
if workingDirectory.IsValueCreated then
Copy link
Member

Choose a reason for hiding this comment

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

Don't you only want to delete the directory if line 198 above (Directory.CreateDirectory(directory) |> ignore) was executed, not simply if the lazy block was entered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brettfo , I think the real issue, is that the directory must be created. If a directory with the name already exists, then it's still a problem. Of course, given that the directory name is 'managed threadid - some randomly generated guid' then it's unlikely to already exist. But I shall address that.

@KevinRansom KevinRansom merged commit c445c57 into dotnet:main Nov 16, 2021
@KevinRansom KevinRansom deleted the fixpm branch January 21, 2022 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fsc deletes the output directory FSI fails with "error FS3217: No such file or directory"

2 participants