@@ -55,14 +55,6 @@ public class ScriptHostManager : IScriptHostEnvironment, IDisposable
5555 public ScriptHostManager ( ScriptHostConfiguration config , IScriptEventManager eventManager = null , IScriptHostEnvironment environment = null , HostPerformanceManager hostPerformanceManager = null )
5656 : this ( config , ScriptSettingsManager . Instance , new ScriptHostFactory ( ) , eventManager , environment , hostPerformanceManager )
5757 {
58- if ( config . FileWatchingEnabled )
59- {
60- // We only setup a subscription here as the actual ScriptHost will create the publisher
61- // when initialized.
62- _fileEventSubscription = EventManager . OfType < FileEvent > ( )
63- . Where ( f => string . Equals ( f . Source , EventSources . ScriptFiles , StringComparison . Ordinal ) )
64- . Subscribe ( e => OnScriptFileChanged ( null , e . FileChangeArguments ) ) ;
65- }
6658 }
6759
6860 public ScriptHostManager ( ScriptHostConfiguration config ,
@@ -92,6 +84,15 @@ public ScriptHostManager(ScriptHostConfiguration config,
9284 _structuredLogWriter = new StructuredLogWriter ( EventManager , config . RootLogPath ) ;
9385 _performanceManager = hostPerformanceManager ?? new HostPerformanceManager ( settingsManager , _config . HostHealthMonitor ) ;
9486
87+ if ( config . FileWatchingEnabled && ! settingsManager . FileSystemIsReadOnly )
88+ {
89+ // We only setup a subscription here as the actual ScriptHost will create the publisher
90+ // when initialized.
91+ _fileEventSubscription = EventManager . OfType < FileEvent > ( )
92+ . Where ( f => string . Equals ( f . Source , EventSources . ScriptFiles , StringComparison . Ordinal ) )
93+ . Subscribe ( e => OnScriptFileChanged ( null , e . FileChangeArguments ) ) ;
94+ }
95+
9596 if ( ShouldMonitorHostHealth )
9697 {
9798 _hostHealthCheckTimer = new Timer ( OnHostHealthCheckTimer , null , TimeSpan . Zero , _config . HostHealthMonitor . HealthCheckInterval ) ;
0 commit comments