@@ -55,14 +55,6 @@ public class ScriptHostManager : IScriptHostEnvironment, IDisposable
55
55
public ScriptHostManager ( ScriptHostConfiguration config , IScriptEventManager eventManager = null , IScriptHostEnvironment environment = null , HostPerformanceManager hostPerformanceManager = null )
56
56
: this ( config , ScriptSettingsManager . Instance , new ScriptHostFactory ( ) , eventManager , environment , hostPerformanceManager )
57
57
{
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
- }
66
58
}
67
59
68
60
public ScriptHostManager ( ScriptHostConfiguration config ,
@@ -92,6 +84,15 @@ public ScriptHostManager(ScriptHostConfiguration config,
92
84
_structuredLogWriter = new StructuredLogWriter ( EventManager , config . RootLogPath ) ;
93
85
_performanceManager = hostPerformanceManager ?? new HostPerformanceManager ( settingsManager , _config . HostHealthMonitor ) ;
94
86
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
+
95
96
if ( ShouldMonitorHostHealth )
96
97
{
97
98
_hostHealthCheckTimer = new Timer ( OnHostHealthCheckTimer , null , TimeSpan . Zero , _config . HostHealthMonitor . HealthCheckInterval ) ;
0 commit comments