Skip to content

Commit

Permalink
[dotnet] Fix driver service path determination when starting it directly
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Oct 19, 2023
1 parent cee7f6b commit 6f97b8d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dotnet/src/webdriver/DriverService.cs
Expand Up @@ -262,13 +262,17 @@ public void Start()
return;
}

if (this.driverServicePath == null)
this.driverServiceProcess = new Process();

if (this.driverServicePath != null)
{
DriverFinder.FullPath(this.GetDefaultDriverOptions());
this.driverServiceProcess.StartInfo.FileName = Path.Combine(this.driverServicePath, this.driverServiceExecutableName);
}
else
{
this.driverServiceProcess.StartInfo.FileName = DriverFinder.FullPath(this.GetDefaultDriverOptions());
}

this.driverServiceProcess = new Process();
this.driverServiceProcess.StartInfo.FileName = Path.Combine(this.driverServicePath, this.driverServiceExecutableName);
this.driverServiceProcess.StartInfo.Arguments = this.CommandLineArguments;
this.driverServiceProcess.StartInfo.UseShellExecute = false;
this.driverServiceProcess.StartInfo.CreateNoWindow = this.hideCommandPromptWindow;
Expand Down

1 comment on commit 6f97b8d

@nvborisenko
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop! This class should be stateful. I mean we should adjust private fields when do some magic.

Please sign in to comment.