johnno1962 / HotReloading

Hot reloading as a Swift Package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🔥 ⚠️ Error reading /.../evalXXX.sh, scanCommand: /.../command.sh

MariuszWisniewski opened this issue · comments

I'm using HotReloading straight from the main branch.

I tried to use HotReloading in our project, and quite often I get error message.
I managed to reproduce the same on an empty project, seems to happen more frequent on iOS 12 than 13 (when testing on 13 I also bump the minimum deployment target).

🔥 ⚠️ Error reading /Users/mariuszwisniewski/Library/Developer/CoreSimulator/Devices/805D1E12-6F50-4175-8C9E-E8B19D7059D6/data/Containers/Data/Application/5C1C27AC-C253-4379-9DFE-0EA8863BF855/tmp/eval144.sh, scanCommand: /Users/mariuszwisniewski/Library/Developer/CoreSimulator/Devices/805D1E12-6F50-4175-8C9E-E8B19D7059D6/data/Containers/Data/Application/5C1C27AC-C253-4379-9DFE-0EA8863BF855/tmp/command.sh

When this error appears in the console, the file mentioned in the error does not exist (so e.g. eval144.sh is not present), just its .pl version and the command.sh file.

When debugging SwiftEval.swift I can see that return runner.run(script: cmdfile) does return true so all should be fine. When I run command.sh manually, it does create mentioned eval144.sh.

What I also tried, was to put a breakpoint before

        var compileCommand: String
        do {
            compileCommand = try String(contentsOfFile: "\(tmpfile).sh")

and at this point run command.sh from terminal, which does create the file. It does help in a sense that the error does not appear anymore (even for the next evaluations), but the app is not refreshed (i.e. my code changes are not taken into acccount).

I also tried the standalone version of InjectIII app combined with https://github.com/krzysztofzablocki/Inject which seems to work fine.

Is there any other info I could provide to help debug the issue?

Hi, That is indeed a strange issue but it will be a lot easier to debug as you are using HotReloading. command.sh needs to have completed for evalN.sh to be created. It's just the grep of the build logs for the compile command. At this distance I can't say much more. It's strange that it should be iOS version dependant but as you can see there is a lot of quite low level stuff going on in the "runner" which is how HoReloading gets it's work done.

Hi, I've finally been able to get to the bottom of this issue which occurs when you use a simulator < iOS14 on an M1/2 due to these simulators not having arm architecture available. I've tightened up error reporting and you should now see a warning to avoid this combination when using HotReloading. johnno1962/InjectionIII#417 (comment)

Thank you very much, that would not be obvious to me!

It wasn't obvious to me :)