Kodi black after System.Exec

Hi,

I have an small problem.
To manage my home automation I have add some own buttons to the home screen.
The buttons triggers eg. “System.Exec(/home/osmc/sw/floor.sh)”.

On LibreELEC that works fine, but unter OSMC the floor.sh will be triggert and then Kodi stays black untill I restart my vero.

Do anyone have an Idea how I can fix that?

Regards,
Tom

What’s in ‘floor.sh’?

@DBMandrake, didn’t you mention a fork() bug with Kodi in System.Exec once?

Sam

#!/bin/bash

kodi-send --action="Notification(ASM,The switch was triggered,3000)"
curl http://api.asm.local/sw.php?id=9

exit 0

Is the only content of the file.

Edit:
Kodi it self is still running (I still hear music, and the webinterface in on too) only the screen is black.

We might have an OSMC bug here. This would affect all platforms. A search for System.Exec on the Kodi forum seems to suggest there are some problems.

See http://kodi.wiki/view/list_of_built-in_functions. You could try RunScript and wrap the call to the bash script with a Python one (a bit ugly, for sure), or even rewrite the script in Python as it’s simple enough.

Sam

Okay,

I have try it with RunScript and it works (only a bit slow, but that is okay)

Thanks a lot for your fast answer :slight_smile:

More than welcome.

I will investigate the System.Exec() issue shortly. However, I suspect this won’t improve the speed :slight_smile:

Consider checking whether the PHP script is a little slow instead.

Sam

I’m absolutly not an python expert, so I think it is the python script :x
The PHP Script runs in unter 0,5sec. But trough the python script the request needs arround 2-3secs.

import requests
res = requests.get('http://api.asm.local/sw.php?id=9')

So, it is an quick and dirty solution that work :wink:

Probably a bit of time to bring the Python interpreter up.

import urllib.request
with urllib.request.urlopen('http://api.asm.local/sw.php?id=9') as response:
   html = response.read()

is another option.

Anyway, you’ve reminded us of an old OSMC bug (if it works in LE), so I’ll look at fixing it up.

1 Like

Any news regarding a solution for this bug? :slight_smile:

I have absolutely zero experience with python.

I have tried to convert bash to python, with this script : Bash To Python script translator
But still can’t get it to work.

My script is working fine in command line (putty)
Both script file, and the commands entered manually.

I want to run the script, with a click on the remote…
Eveything runs fine… except for the black screen afterwards :frowning:

Best regards.

I looked at this a while ago and came to the conclusion that it’s broken in Kodi.

It’s working just fine in LibreELEC

Yes, I took a look at that and believe it’s because they start Kodi differently.

I can replicate this on Ubuntu 16.04. It’s still likely a bug in Kodi however as the version on my laptop isn’t patched. See System.Exec Function - #4 by DBMandrake.