Skip to content

Commit

Permalink
chore: add warning message during finch vm init for windows users (#1170
Browse files Browse the repository at this point in the history
)

Signed-off-by: Subash Kotha <[email protected]>
Co-authored-by: Subash Kotha <[email protected]>
  • Loading branch information
subashkotha and Subash Kotha authored Nov 6, 2024
1 parent 507d636 commit 35578b6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/finch/virtual_machine_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main

import (
"fmt"
"runtime"

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

Expand Down Expand Up @@ -114,6 +115,13 @@ func (iva *initVMAction) run() error {
_ = iva.diskManager.DetachUserDataDisk()
return err
}

if runtime.GOOS == "windows" {
iva.logger.Warnln("Finch on Windows uses WSL, which mounts the C Drive in read-write mode by default. " +
"To run finch with more restricted access, follow " +
"https://runfinch.com/docs/managing-finch/windows/wsl-configuration/")
}

iva.logger.Info("Finch virtual machine started successfully")
return nil
}
Expand Down
16 changes: 16 additions & 0 deletions cmd/finch/virtual_machine_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package main
import (
"errors"
"fmt"
"runtime"
"testing"

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

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

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

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

0 comments on commit 35578b6

Please sign in to comment.