File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/csharp/Extensions/Microsoft.Spark.Extensions.DotNet.Interactive Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ namespace Microsoft.Spark.Extensions.DotNet.Interactive
2525 public class AssemblyKernelExtension : IKernelExtension
2626 {
2727 private const string TempDirEnvVar = "DOTNET_SPARK_EXTENSION_INTERACTIVE_TMPDIR" ;
28+ private const string PreserveTempDirEnvVar = "DOTNET_SPARK_EXTENSION_INTERACTIVE_PRESERVE_TMPDIR" ;
2829
2930 private readonly PackageResolver _packageResolver =
3031 new PackageResolver ( new SupportNugetWrapper ( ) ) ;
@@ -41,7 +42,11 @@ public Task OnLoadAsync(Kernel kernel)
4142 Environment . SetEnvironmentVariable ( Constants . RunningREPLEnvVar , "true" ) ;
4243
4344 DirectoryInfo tempDir = CreateTempDirectory ( ) ;
44- compositeKernel . RegisterForDisposal ( new DisposableDirectory ( tempDir ) ) ;
45+
46+ if ( ! EnvironmentUtils . GetEnvironmentVariableAsBool ( PreserveTempDirEnvVar ) )
47+ {
48+ compositeKernel . RegisterForDisposal ( new DisposableDirectory ( tempDir ) ) ;
49+ }
4550
4651 compositeKernel . AddMiddleware ( async ( command , context , next ) =>
4752 {
You can’t perform that action at this time.
0 commit comments