зеркало из https://github.com/dotnet/spark.git
Extensions.DotNet.Interactive - Add ENV to control disposal of tmp dir (#952)
This commit is contained in:
Родитель
4ede264c2b
Коммит
a18bb5f638
|
@ -25,6 +25,7 @@ namespace Microsoft.Spark.Extensions.DotNet.Interactive
|
||||||
public class AssemblyKernelExtension : IKernelExtension
|
public class AssemblyKernelExtension : IKernelExtension
|
||||||
{
|
{
|
||||||
private const string TempDirEnvVar = "DOTNET_SPARK_EXTENSION_INTERACTIVE_TMPDIR";
|
private const string TempDirEnvVar = "DOTNET_SPARK_EXTENSION_INTERACTIVE_TMPDIR";
|
||||||
|
private const string PreserveTempDirEnvVar = "DOTNET_SPARK_EXTENSION_INTERACTIVE_PRESERVE_TMPDIR";
|
||||||
|
|
||||||
private readonly PackageResolver _packageResolver =
|
private readonly PackageResolver _packageResolver =
|
||||||
new PackageResolver(new SupportNugetWrapper());
|
new PackageResolver(new SupportNugetWrapper());
|
||||||
|
@ -41,7 +42,11 @@ namespace Microsoft.Spark.Extensions.DotNet.Interactive
|
||||||
Environment.SetEnvironmentVariable(Constants.RunningREPLEnvVar, "true");
|
Environment.SetEnvironmentVariable(Constants.RunningREPLEnvVar, "true");
|
||||||
|
|
||||||
DirectoryInfo tempDir = CreateTempDirectory();
|
DirectoryInfo tempDir = CreateTempDirectory();
|
||||||
compositeKernel.RegisterForDisposal(new DisposableDirectory(tempDir));
|
|
||||||
|
if (!EnvironmentUtils.GetEnvironmentVariableAsBool(PreserveTempDirEnvVar))
|
||||||
|
{
|
||||||
|
compositeKernel.RegisterForDisposal(new DisposableDirectory(tempDir));
|
||||||
|
}
|
||||||
|
|
||||||
compositeKernel.AddMiddleware(async (command, context, next) =>
|
compositeKernel.AddMiddleware(async (command, context, next) =>
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче