Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test(runtime): give the discovery stub a name Windows can execute

Darshan Jain3334bb8999c3
diff --git a/internal/bridge/runtime/exesuffix_test.go b/internal/bridge/runtime/exesuffix_test.go
new file mode 100644
index 00000000..09b78d82
--- /dev/null
+++ b/internal/bridge/runtime/exesuffix_test.go
@@ -0,0 +1,13 @@
+package runtime
+
+import "runtime"
+
+// exeSuffix is what this platform requires on the end of an executable's name.
+// Windows decides executability by extension, so a stub without one is not a
+// browser as far as discovery is concerned.
+var exeSuffix = func() string {
+ if runtime.GOOS == "windows" {
+ return ".exe"
+ }
+ return ""
+}()
diff --git a/internal/bridge/runtime/init_target_test.go b/internal/bridge/runtime/init_target_test.go
index fdda74cc..d9fb41b4 100644
--- a/internal/bridge/runtime/init_target_test.go
+++ b/internal/bridge/runtime/init_target_test.go
@@ -62,7 +62,11 @@ func TestEffectiveLaunchTargetPrefersTargetBinaryOverDiscovery(t *testing.T) {
func TestEffectiveLaunchTargetFallsBackToDiscoveryWithoutTargets(t *testing.T) {
withoutBrowserDiscovery(t)
dir := t.TempDir()
- discovered := filepath.Join(dir, "cloakbrowser")
+ // The stub has to be something the host agrees is executable, or discovery
+ // correctly refuses it and there is nothing left to fall back to. On Windows
+ // that means an extension PATHEXT names: exec.LookPath will not return a bare
+ // "cloakbrowser" there, and the mode bits below carry no meaning.
+ discovered := filepath.Join(dir, "cloakbrowser"+exeSuffix)
if err := os.WriteFile(discovered, []byte("#!/bin/sh\n"), 0o755); err != nil {
t.Fatalf("WriteFile() error = %v", err)
}