Skip to content

Commit 35578b6

Browse files
subashkothaSubash Kotha
and
Subash Kotha
authored
chore: add warning message during finch vm init for windows users (runfinch#1170)
Signed-off-by: Subash Kotha <[email protected]> Co-authored-by: Subash Kotha <[email protected]>
1 parent 507d636 commit 35578b6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Diff for: cmd/finch/virtual_machine_init.go

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77

88
import (
99
"fmt"
10+
"runtime"
1011

1112
"github.com/runfinch/finch/pkg/disk"
1213

@@ -114,6 +115,13 @@ func (iva *initVMAction) run() error {
114115
_ = iva.diskManager.DetachUserDataDisk()
115116
return err
116117
}
118+
119+
if runtime.GOOS == "windows" {
120+
iva.logger.Warnln("Finch on Windows uses WSL, which mounts the C Drive in read-write mode by default. " +
121+
"To run finch with more restricted access, follow " +
122+
"https://runfinch.com/docs/managing-finch/windows/wsl-configuration/")
123+
}
124+
117125
iva.logger.Info("Finch virtual machine started successfully")
118126
return nil
119127
}

Diff for: cmd/finch/virtual_machine_init_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package main
88
import (
99
"errors"
1010
"fmt"
11+
"runtime"
1112
"testing"
1213

1314
"github.com/runfinch/finch/pkg/dependency"
@@ -83,6 +84,11 @@ func TestInitVMAction_runAdapter(t *testing.T) {
8384
command.EXPECT().CombinedOutput()
8485

8586
logger.EXPECT().Info("Initializing and starting Finch virtual machine...")
87+
if runtime.GOOS == "windows" {
88+
logger.EXPECT().Warnln("Finch on Windows uses WSL, which mounts the C Drive in read-write mode by default. " +
89+
"To run finch with more restricted access, follow " +
90+
"https://runfinch.com/docs/managing-finch/windows/wsl-configuration/")
91+
}
8692
logger.EXPECT().Info("Finch virtual machine started successfully")
8793
},
8894
},
@@ -151,6 +157,11 @@ func TestInitVMAction_run(t *testing.T) {
151157
command.EXPECT().CombinedOutput()
152158

153159
logger.EXPECT().Info("Initializing and starting Finch virtual machine...")
160+
if runtime.GOOS == "windows" {
161+
logger.EXPECT().Warnln("Finch on Windows uses WSL, which mounts the C Drive in read-write mode by default. " +
162+
"To run finch with more restricted access, follow " +
163+
"https://runfinch.com/docs/managing-finch/windows/wsl-configuration/")
164+
}
154165
logger.EXPECT().Info("Finch virtual machine started successfully")
155166
},
156167
},
@@ -276,6 +287,11 @@ func TestInitVMAction_run(t *testing.T) {
276287
command.EXPECT().CombinedOutput()
277288

278289
logger.EXPECT().Info("Initializing and starting Finch virtual machine...")
290+
if runtime.GOOS == "windows" {
291+
logger.EXPECT().Warnln("Finch on Windows uses WSL, which mounts the C Drive in read-write mode by default. " +
292+
"To run finch with more restricted access, follow " +
293+
"https://runfinch.com/docs/managing-finch/windows/wsl-configuration/")
294+
}
279295
logger.EXPECT().Info("Finch virtual machine started successfully")
280296
},
281297
},

0 commit comments

Comments
 (0)