Hello!<br><br>I'm writing a plug-in for Geany using geanylua which wraps a handful of calls to some of our internal utilities with varying arguments. For example, if one option is selected on the dialog prompt then I might invoke "foo --abc", though another option would invoke "foo --xyz". I'd like to wrap the invocation in a coroutine since foo may take several minutes to complete and I don't want Geany to appear as if it's hung. Unfortunately, may code isn't working as I would expect.<br>
<br>My Lua code that performs the actual invocation is:<br><br>-- execute cmd with dir as it's working directory<br>function myExec (cmd, dir)<br> local old = geany.wkdir()<br> local c = coroutine.create(<br> function ()<br>
geany.wkdir(dir)<br> os.execute(cmd)<br> geany.wkdir(old)<br> geany.message("Action completed.")<br> end<br> )<br> coroutine.resume(c)<br>end<br><br>I'm not a Lua guru by any stretch of the imagination... so there may be something wrong with my understanding of coroutines in Lua. Or, is this an implementation issue in geanylua?<br>
<br>Any suggestions that can get me pointed in the right direction are welcome... I'd prefer not to have write the plug-in in C++ if I can avoid it! :)<br><br><br>-Tim<br><br>