All of lore.kernel.org
 help / color / mirror / Atom feed
* lua 'grub.run' does not return message text
@ 2010-01-14 21:12 edgar.soldin
  2010-01-15 23:52 ` Jordan Uggla
  2010-01-16 23:48 ` Jordan Uggla
  0 siblings, 2 replies; 5+ messages in thread
From: edgar.soldin @ 2010-01-14 21:12 UTC (permalink / raw)
  To: grub-devel

When I run

err,msg = grub.run("ls")

only the variable err is filled with the exit code.
msg is still nil .. I saw documentation that grub.run is supposed to 
return the output in the second variable.

I use lua from grub-extras repository
http://bzr.savannah.gnu.org/lh/grub-extras/
checked out yesterday.

What am I doing wrong?

Thanks .. ede




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lua 'grub.run' does not return message text
  2010-01-14 21:12 lua 'grub.run' does not return message text edgar.soldin
@ 2010-01-15 23:52 ` Jordan Uggla
  2010-01-16  0:04   ` Jordan Uggla
  2010-01-16 23:48 ` Jordan Uggla
  1 sibling, 1 reply; 5+ messages in thread
From: Jordan Uggla @ 2010-01-15 23:52 UTC (permalink / raw)
  To: The development of GNU GRUB

On Thu, Jan 14, 2010 at 1:12 PM,  <edgar.soldin@web.de> wrote:
> When I run
>
> err,msg = grub.run("ls")
>
> only the variable err is filled with the exit code.
> msg is still nil .. I saw documentation that grub.run is supposed to return
> the output in the second variable.
>
> I use lua from grub-extras repository
> http://bzr.savannah.gnu.org/lh/grub-extras/
> checked out yesterday.
>
> What am I doing wrong?
>
> Thanks .. ede
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>

Looking briefly at the code, grub.run doesn't even attempt to return
the error message ( though that might be a useful feature to add ).
What documentation were you looking at?

-- 
Jordan Uggla ( Jordan_U on irc.freenode.net )



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lua 'grub.run' does not return message text
  2010-01-15 23:52 ` Jordan Uggla
@ 2010-01-16  0:04   ` Jordan Uggla
  0 siblings, 0 replies; 5+ messages in thread
From: Jordan Uggla @ 2010-01-16  0:04 UTC (permalink / raw)
  To: The development of GNU GRUB

On Fri, Jan 15, 2010 at 3:52 PM, Jordan Uggla <jordan.uggla@gmail.com> wrote:
> On Thu, Jan 14, 2010 at 1:12 PM,  <edgar.soldin@web.de> wrote:
>> When I run
>>
>> err,msg = grub.run("ls")
>>
>> only the variable err is filled with the exit code.
>> msg is still nil .. I saw documentation that grub.run is supposed to return
>> the output in the second variable.
>>
>> I use lua from grub-extras repository
>> http://bzr.savannah.gnu.org/lh/grub-extras/
>> checked out yesterday.
>>
>> What am I doing wrong?
>>
>> Thanks .. ede
>>
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>
> Looking briefly at the code, grub.run doesn't even attempt to return
> the error message ( though that might be a useful feature to add ).
> What documentation were you looking at?
>
> --
> Jordan Uggla ( Jordan_U on irc.freenode.net )
>

I forgot to mention, you can get the error message from the global
grub_errmsg after running grub.run(), but returning it would be a much
cleaner interface IMHO. It should be easy to also return the error
message but I am going to be very busy with other things until
February so I probably won't be able to work on it myself any time
soon.

-- 
Jordan Uggla ( Jordan_U on irc.freenode.net )



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lua 'grub.run' does not return message text
  2010-01-14 21:12 lua 'grub.run' does not return message text edgar.soldin
  2010-01-15 23:52 ` Jordan Uggla
@ 2010-01-16 23:48 ` Jordan Uggla
  2010-01-17  0:21   ` edgar.soldin
  1 sibling, 1 reply; 5+ messages in thread
From: Jordan Uggla @ 2010-01-16 23:48 UTC (permalink / raw)
  To: The development of GNU GRUB

On Thu, Jan 14, 2010 at 1:12 PM,  <edgar.soldin@web.de> wrote:
> When I run
>
> err,msg = grub.run("ls")
>
> only the variable err is filled with the exit code.
> msg is still nil .. I saw documentation that grub.run is supposed to return
> the output in the second variable.

In the latest bzr ( pushed a few minutes ago ) the interface matches
what is documented in http://grub.enbug.org/LUASupport . Be careful
though, it's only the error message that is returned, not the output
of "ls". And an error message is only returned if there is an error.
For example:

errno, err_msg = grub.run( "ls /boot") --Outputs "grub/"
print( errno, err_msg ) -- Outputs "0        nil"

errno, err_msg = grub.run( "ls /boot/nonexistent" ) -- Outputs nothing
print( errno, err_msg ) -- Outputs "5        file not found"

If you want to actually list and store devices / files from lua you
should use grub.enum_device() and grub.enum_file() .

-- 
Jordan Uggla ( Jordan_U on irc.freenode.net )



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lua 'grub.run' does not return message text
  2010-01-16 23:48 ` Jordan Uggla
@ 2010-01-17  0:21   ` edgar.soldin
  0 siblings, 0 replies; 5+ messages in thread
From: edgar.soldin @ 2010-01-17  0:21 UTC (permalink / raw)
  To: The development of GNU GRUB

thanks .. I am gonna double check this. Are their other undocumented 
variables like grub_errmsg. Where should I look for documentation? I'd 
also look at the source if necessary.

About what I am doing. I found the listiso scripts
http://ubuntuforums.org/showthread.php?t=1288604
while trying to get them up and running they silently died because of 
missing modules. Essentially I wanted to parse lsmod. Because that's 
currently not possible I simply check if insmod fails or not.

Do you have an idea on how to parse grub.run output in the current state 
of the lua module?

Thanks again .. ede


On 17.01.2010 00:48, Jordan Uggla wrote:
> On Thu, Jan 14, 2010 at 1:12 PM,<edgar.soldin@web.de>  wrote:
>> When I run
>>
>> err,msg = grub.run("ls")
>>
>> only the variable err is filled with the exit code.
>> msg is still nil .. I saw documentation that grub.run is supposed to return
>> the output in the second variable.
>
> In the latest bzr ( pushed a few minutes ago ) the interface matches
> what is documented in http://grub.enbug.org/LUASupport . Be careful
> though, it's only the error message that is returned, not the output
> of "ls". And an error message is only returned if there is an error.
> For example:
>
> errno, err_msg = grub.run( "ls /boot") --Outputs "grub/"
> print( errno, err_msg ) -- Outputs "0        nil"
>
> errno, err_msg = grub.run( "ls /boot/nonexistent" ) -- Outputs nothing
> print( errno, err_msg ) -- Outputs "5        file not found"
>
> If you want to actually list and store devices / files from lua you
> should use grub.enum_device() and grub.enum_file() .
>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-17  0:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 21:12 lua 'grub.run' does not return message text edgar.soldin
2010-01-15 23:52 ` Jordan Uggla
2010-01-16  0:04   ` Jordan Uggla
2010-01-16 23:48 ` Jordan Uggla
2010-01-17  0:21   ` edgar.soldin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.