From 17ce5e8246d13b2fc85c53b1619b038818a1ba94 Mon Sep 17 00:00:00 2001 From: Erik Gilling Date: Sat, 21 Sep 2019 18:06:59 -0700 Subject: [PATCH] Only copy elf file if it exists. Some boards do not produce elf file intermediate (i.e those that use build.preferred_export_format=axf or the like). This changes the logic so that it's not an error for and elf file to be missing. --- commands/compile/compile.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/compile/compile.go b/commands/compile/compile.go index 9b0a1f380f9..1b23fdc9ef0 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -209,10 +209,12 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W // Copy .elf file to sketch directory srcElf := paths.New(outputPath[:len(outputPath)-3] + "elf") - dstElf := exportPath.Join(exportFile + ".elf") - logrus.WithField("from", srcElf).WithField("to", dstElf).Debug("copying sketch build output") - if err = srcElf.CopyTo(dstElf); err != nil { - return nil, fmt.Errorf("copying elf file: %s", err) + if srcElf.Exist() { + dstElf := exportPath.Join(exportFile + ".elf") + logrus.WithField("from", srcElf).WithField("to", dstElf).Debug("copying sketch build output") + if err = srcElf.CopyTo(dstElf); err != nil { + return nil, fmt.Errorf("copying elf file: %s", err) + } } logrus.Tracef("Compile %s for %s successful", sketch.Name, fqbnIn)