Re: Execute command and wait until it's execution finishes

2015-08-12 Thread Elv1313 .
Yes,

The one I posted above in this thread and using pipes to awesome-client,
also mentionned in this thread.
On Aug 12, 2015 12:53 PM, "Jayson Willson" 
wrote:

> Yes, one man told me that. Is there any other way to run system command
> and lua command one after another, but without freeze? I have created a
> question is Awesome issue. https://github.com/awesomeWM/awesome/issues/403
>


Re: Execute command and wait until it's execution finishes

2015-08-12 Thread Elv1313 .
Please do not use os.execute in rc.lua, it is a blocking function and *ALL*
application will lock until the function return. Even if the command is
fast, they all add up and, milliseconds by milliseconds, make your computer
less responsive.
On Aug 11, 2015 2:31 PM, "Jayson Willson" 
wrote:

> That's wonderful! Thank you, it really works :)
>
> --
> To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
>


Re: Execute command and wait until it's execution finishes

2015-08-11 Thread Jayson Willson

That's wonderful! Thank you, it really works :)

--
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.


Re: Execute command and wait until it's execution finishes

2015-08-11 Thread lilydjwg
On Mon, Aug 10, 2015 at 07:15:04PM +0300, Jayson Willson wrote:
> Hello! I need the following: execute some command and go to the next command
> of the function only when the first command is finished.
> What I have now:
> 
> awful.key({}, "XF86AudioMute",
>   function ()
>   awful.util.spawn("amixer set Master toggle")
>   update_volume(volume_widget)
>   end)
> 
> Thus "update_volume" takes place earlier, than "amixer set Master toggle"
> finishes it's execution, and I do not get required result.
> 
> One guy suggested using popen:
>   function ()
>   local f = io.popen("amixer set Master toggle")
>   f:close()
>   update_volume(volume_widget)
>   end)
> It works fine, but I wonder if there is a way to implement it without pipes.
> Could you please help me? Thank you.

os.execute is what you want in this case.

-- 
Best regards,
lilydjwg

-- 
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.


Re: Execute command and wait until it's execution finishes

2015-08-10 Thread Elv1313 .
Hello,

You can use my async module located here
https://github.com/Elv13/awesome-configs/blob/master/utils/fd_async.lua

It has lots of non-blocking async functions to do things like you
want. However be warned many people report it segfault Awesome in some
situations. This seem to be caused by various LGI bugs and maybe a few
introduced by my code too. It is stable enough for my use case, but I
totally acknowledge some corner cases can cause segfaults.

On 10 August 2015 at 14:06, Jayson Willson  wrote:
> Actually, there is no reason not to use them. I just do not know, if this
> way is the correct and the optimal one. And, really, I do not know what
> "pipe" is.. :-)
>
>
> --
> To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.

-- 
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.


Re: Execute command and wait until it's execution finishes

2015-08-10 Thread Jayson Willson
Actually, there is no reason not to use them. I just do not know, if 
this way is the correct and the optimal one. And, really, I do not know 
what "pipe" is.. :-)


--
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.


Re: Execute command and wait until it's execution finishes

2015-08-10 Thread Bruno Ferreira
Hi Jayson,

Using pipes seems to me like a great way to do it, why don't you want to
use pipes?

2015-08-10 17:15 GMT+01:00 Jayson Willson :

> Hello! I need the following: execute some command and go to the next
> command of the function only when the first command is finished.
> What I have now:
>
> awful.key({}, "XF86AudioMute",
> function ()
> awful.util.spawn("amixer set Master toggle")
> update_volume(volume_widget)
> end)
>
> Thus "update_volume" takes place earlier, than "amixer set Master toggle"
> finishes it's execution, and I do not get required result.
>
> One guy suggested using popen:
> function ()
> local f = io.popen("amixer set Master toggle")
> f:close()
> update_volume(volume_widget)
> end)
> It works fine, but I wonder if there is a way to implement it without
> pipes. Could you please help me? Thank you.
>
> --
> To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
>


Execute command and wait until it's execution finishes

2015-08-10 Thread Jayson Willson
Hello! I need the following: execute some command and go to the next 
command of the function only when the first command is finished.

What I have now:

awful.key({}, "XF86AudioMute",
function ()
awful.util.spawn("amixer set Master toggle")
update_volume(volume_widget)
end)

Thus "update_volume" takes place earlier, than "amixer set Master 
toggle" finishes it's execution, and I do not get required result.


One guy suggested using popen:
function ()
local f = io.popen("amixer set Master toggle")
f:close()
update_volume(volume_widget)
end)
It works fine, but I wonder if there is a way to implement it without 
pipes. Could you please help me? Thank you.


--
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.