====== button_exec plugin ====== This plugin starts an external program and does not wait for it. It is meant to be used with the [[:lcd4linux:widget_keypad|keypad widget]], to run a command once when a key is pressed. The difference to the [[:lcd4linux:plugin_exec|exec plugin]]: //exec// runs a command periodically and returns its output, //button_exec// runs the command exactly once per call and returns immediately. ---- ===== Functions ===== |button_exec(command, arg1, arg2, ...)|start //command// with the given arguments| * The first parameter is the program, all following parameters are passed to it as arguments, one parameter per argument. The program is searched in the //PATH//; there is no shell involved, so redirections and pipes do not work. * The program runs in the background. The function returns '0' as soon as it has been started. There is **no** way to get the exit code or the output of the program. ---- ===== Example ===== Widget StopPlayer { class 'Keypad' position 'confirm' state 'pressed' expression button_exec('/usr/bin/mpc', 'stop') } Layout Default { Keypad1 'StopPlayer' } ---- ===== Requirements ===== No external libraries. The plugin is selected at build time with //--with-plugins=button_exec// (it is part of 'all'). ----