From 633cd67639f4874ebb1a3450f98739a8af586096 Mon Sep 17 00:00:00 2001
From: ali asaria <aliasaria@users.noreply.github.com>
Date: Wed, 8 Jan 2025 13:05:49 -0500
Subject: [PATCH] poll files to look for changes when on windows

---
 src/main/main.ts | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/main/main.ts b/src/main/main.ts
index 8767c56b..122c8746 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -35,6 +35,7 @@ import {
   checkDependencies,
   checkIfCondaBinExists,
   getLogFilePath,
+  isPlatformWindows,
 } from './util';
 
 import installExtension, {
@@ -147,7 +148,16 @@ const startListeningToServerLog = async () => {
     }
     fs.writeFileSync(logFile, '');
   }
-  let tail = new Tail(logFile);
+
+  let tailOptions = {};
+
+  // If we are on windows, the engine runs in WSL2 but the app runs in Windows so
+  // iNotify doesn't work. We need to use polling.
+  if (isPlatformWindows()) {
+    tailOptions = { useWatchFile: true, fsWatchOptions: { interval: 500 } };
+  }
+
+  let tail = new Tail(logFile, tailOptions);
 
   let currentlySubscribed = false;
 
@@ -167,7 +177,7 @@ const startListeningToServerLog = async () => {
     }
 
     currentlySubscribed = true;
-    tail = new Tail(logFile);
+    tail = new Tail(logFile, tailOptions);
 
     tail.on('line', function (data) {
       // console.log('main.js: line', data);
-- 
GitLab