Skip to content

Commit e3a5513

Browse files
authored
Fixing executable esptool on Linux (#135)
1 parent 78d4a4d commit e3a5513

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

nanoFirmwareFlasher/EspTool.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,24 @@ private bool RunEspTool(
578578
{
579579
appName = "esptool";
580580
appDir = Path.Combine(Program.ExecutingPath, "esptool", "esptoolLinux");
581+
Process espToolExex = new Process();
582+
// Making sure the esptool is executable
583+
espToolExex.StartInfo = new ProcessStartInfo("chmod +x", Path.Combine(appDir, appName))
584+
{
585+
WorkingDirectory = appDir,
586+
UseShellExecute = false,
587+
RedirectStandardError = true,
588+
RedirectStandardOutput = true
589+
};
590+
if (!espToolExex.Start())
591+
{
592+
throw new EspToolExecutionException("Error changing permissions for esptool!");
593+
}
594+
595+
while (!espToolExex.HasExited)
596+
{
597+
Thread.Sleep(10);
598+
}
581599
}
582600

583601
Process espTool = new Process();
@@ -605,7 +623,7 @@ private bool RunEspTool(
605623
if (!espTool.Start())
606624
{
607625
throw new EspToolExecutionException("Error starting esptool!");
608-
}
626+
}
609627

610628
var messageBuilder = new StringBuilder();
611629

0 commit comments

Comments
 (0)