[SOLVED] Can os.execute() be executed after LÖVE is closed?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

[SOLVED] Can os.execute() be executed after LÖVE is closed?

Post by molul »

I need to close my UI app made with LÖVE and launch the selected app in the UI. I used os.execute(cmd), where "cmd" would be <find and kill LÖVE job> && <launch the app command>.

This command works fine from the command line, but if I run it from the UI made with LÖVE, it won't work because the UI won't actually kill itself until the whole command is executed. And I can't launch the selected app with my UI running because (I don't think I'm using the right words but I hope it can be understood) they can't "share the screen" (I get an "xauth: error".

I was thinking on creating a temporary file with the command for launching the app, so the workflow from LÖVE would be:

-create the temporary file with the command
-call love.event.quit()
-somehow call the temporary file right after LÖVE is closed, like a quit callback or something.

Any ideas?


[EDIT]
I hate and love it when this happens: I found the solution shortly after I posted this. The solution is using a couple of scripts.

Script 1: this launches the UI and waits for it to be closed to launch a script called "launchapp.sh":

#!/bin/bash

Code: Select all

XDG_DATA_HOME=/tmp LOVE_GRAPHICS_USE_OPENGLES=1 ./love project.love
wait
./launchapp.sh
Script 2 (launchapp.sh): this one contains the command to launch the application. It is removed and regenerated when you select an application to launch from the UI.

There might be a smarter way, but this one works :)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: [SOLVED] Can os.execute() be executed after LÖVE is closed?

Post by bartbes »

You could also try calling love.window.close, then call os.execute, and re-open the window with love.window.setMode after, that way you have a single continuous love process, if you want.
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: [SOLVED] Can os.execute() be executed after LÖVE is closed?

Post by molul »

Interesting, but I need my frontend to close to save some resources, so I think I'll keep it like that.

Thanks a lot anyway :)
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests