Double run

Using Glider 1.9, I noticed that when you click run/debug, the app seems to run, stop, and then re-run.  I put a print statement and a breakpoint in my system event handler.

[lua]

function onSystemEvent(event)

    print (event.type)

end

Runtime:addEventListener(“system”, onSystemEvent)

[/lua]

When I run the program I get:

applicationStart

applicationEnd

then the Simulator tab resets and I get another:

applicationStart

I tried this on Glider 1.7, as well as the Corona Simulator, and it appears to work as expected… one run.

Not a biggie… just something to be aware of until it’s resolved.  I was wondering if it was something in my code originally.

–John

Hello John,

We will look into this issue and let you know what we find. Are you sure it does not occur in 1.7? We get double starts when the simulator is started from the command line (this is how glider starts the simulator).

Regards,

M.Y. Developers

M.Y,

Actually, just trying it again, and yes, it does happen on 1.7 as well.

It’s not a big deal if this is the way it works… at least now I know.  I was confused as to why this was happening, and I thought there was something I coded to cause this.  If this is normal, then it is just something I will be aware of… 

Thanks for your help.  1.9 is really nice!

Hello John,

Yes it seems to occur when you run anything via the simulator from the command line or maybe its just the way we are launching it, not sure. This does not occur for any other tool (moai,  gideros, or lua console interpreter) 

You can check the system plugins folder for the corona plugin via help->user directory->system plugins->corona->plugin.lua

The launch command looks like this:

 path, --path to simulator "-project", args.buildFolder.."/main.lua" --path to main.lua

Not sure how else to launch it, perhaps the Corona staff can give some insight.

Regards,

M.Y. Developers

Outlaw has also had problems with the simulator launching twice – I’ve spent hours on that and it’s nice to know that maybe it’s *not* me after all. :slight_smile:

The weird thing is, for me it’s been intermittent – for example, right now with my current build I can’t get it to happen at all.  

Because of the way I launch the simulator against a “sandbox” holding the code, I thought it was related to the simulator prefs being set to “launch when project is changed” – and then as the changed files were copied to the sandbox, the simulator would relaunch itself. And if there were enough files that new files were still being copied as the simulator finished launching, it would see “changes to the project” happening and launch again.

I don’t think you guys use a sandbox, but if Glider changes files “behind the scenes” as you launch I wonder if that could be part of the problem?

 Jay

Hello Jay,

Thanks for the suggestion. It is def. not just you having this issue. This problem always occurs when launching from the command line. We have tried:

"C:\Program Files (x86)\Corona Labs\Corona SDK\Corona Simulator.exe" -project "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\GettingStarted\Timer\main.lua"

and we tried playing around with the working directory:

C:\Program Files (x86)\Corona Labs\Corona SDK\>"Corona Simulator.exe"  "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\GettingStarted\Timer\main.lua"

maybe the sandbox directory?

C:\Users\ricebowl1988\AppData\Roaming\Corona Labs\Corona Simulator\Sandbox\timer -605C6E18DA3010BB006454637F81AAD1\>"C:\Program Files (x86)\Corona Labs\Corona SDK \Corona Simulator.exe"  "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Co de\GettingStarted\Timer\main.lua" 

All of these still result in double print. 

Here is what might be going on. When launching from the command line the lua interpreter starts first and runs the main chunk. This results in the first print. After running the main chunk Corona tries to draw the first frame but notices that the simulator window is not opened yet. So it goes ahead and launches the opengl simulator window and re-runs the program. This is where the double print comes from. 

This is evident by placing a breakpoint in the main chunk. The first time it hits you will notice that the simulator window is not launched. The second time it hits the simulator window is launched.

Is this what you also observed? It would be nice to have the command line stuff documented, I am sure everyone would like a feature to build from command line for instance. All we were able to find on this feature is gui automation:http://vimeo.com/29936594 But there should really be a cleaner way to do this via the command line.

Regards,

M.Y. Developers

Hi Guys,

I have different issue with double run. When I select image from “Projects” section and then hit run/debug Glider will open two simulators, then when I click on code simulator will run only once.

Hello Hedge,

does going to run-> set main project fix this problem? Are you on Mac or Windows?

Regards,

M.Y. Developers

I’m using Mac and yes, main project fix problem :slight_smile: Thanks!

No problem! Please let us know if you come across anymore issues.

Regards,

M.Y. Developers

Hello John,

We will look into this issue and let you know what we find. Are you sure it does not occur in 1.7? We get double starts when the simulator is started from the command line (this is how glider starts the simulator).

Regards,

M.Y. Developers

M.Y,

Actually, just trying it again, and yes, it does happen on 1.7 as well.

It’s not a big deal if this is the way it works… at least now I know.  I was confused as to why this was happening, and I thought there was something I coded to cause this.  If this is normal, then it is just something I will be aware of… 

Thanks for your help.  1.9 is really nice!

Hello John,

Yes it seems to occur when you run anything via the simulator from the command line or maybe its just the way we are launching it, not sure. This does not occur for any other tool (moai,  gideros, or lua console interpreter) 

You can check the system plugins folder for the corona plugin via help->user directory->system plugins->corona->plugin.lua

The launch command looks like this:

 path, --path to simulator "-project", args.buildFolder.."/main.lua" --path to main.lua

Not sure how else to launch it, perhaps the Corona staff can give some insight.

Regards,

M.Y. Developers

Outlaw has also had problems with the simulator launching twice – I’ve spent hours on that and it’s nice to know that maybe it’s *not* me after all. :slight_smile:

The weird thing is, for me it’s been intermittent – for example, right now with my current build I can’t get it to happen at all.  

Because of the way I launch the simulator against a “sandbox” holding the code, I thought it was related to the simulator prefs being set to “launch when project is changed” – and then as the changed files were copied to the sandbox, the simulator would relaunch itself. And if there were enough files that new files were still being copied as the simulator finished launching, it would see “changes to the project” happening and launch again.

I don’t think you guys use a sandbox, but if Glider changes files “behind the scenes” as you launch I wonder if that could be part of the problem?

 Jay

Hello Jay,

Thanks for the suggestion. It is def. not just you having this issue. This problem always occurs when launching from the command line. We have tried:

"C:\Program Files (x86)\Corona Labs\Corona SDK\Corona Simulator.exe" -project "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\GettingStarted\Timer\main.lua"

and we tried playing around with the working directory:

C:\Program Files (x86)\Corona Labs\Corona SDK\>"Corona Simulator.exe"  "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\GettingStarted\Timer\main.lua"

maybe the sandbox directory?

C:\Users\ricebowl1988\AppData\Roaming\Corona Labs\Corona Simulator\Sandbox\timer -605C6E18DA3010BB006454637F81AAD1\>"C:\Program Files (x86)\Corona Labs\Corona SDK \Corona Simulator.exe"  "C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Co de\GettingStarted\Timer\main.lua" 

All of these still result in double print. 

Here is what might be going on. When launching from the command line the lua interpreter starts first and runs the main chunk. This results in the first print. After running the main chunk Corona tries to draw the first frame but notices that the simulator window is not opened yet. So it goes ahead and launches the opengl simulator window and re-runs the program. This is where the double print comes from. 

This is evident by placing a breakpoint in the main chunk. The first time it hits you will notice that the simulator window is not launched. The second time it hits the simulator window is launched.

Is this what you also observed? It would be nice to have the command line stuff documented, I am sure everyone would like a feature to build from command line for instance. All we were able to find on this feature is gui automation:http://vimeo.com/29936594 But there should really be a cleaner way to do this via the command line.

Regards,

M.Y. Developers

Hi Guys,

I have different issue with double run. When I select image from “Projects” section and then hit run/debug Glider will open two simulators, then when I click on code simulator will run only once.

Hello Hedge,

does going to run-> set main project fix this problem? Are you on Mac or Windows?

Regards,

M.Y. Developers

I’m using Mac and yes, main project fix problem :slight_smile: Thanks!

No problem! Please let us know if you come across anymore issues.

Regards,

M.Y. Developers