[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OSX: Interrupted system call
- From: Eric Wing <ewmailing@...>
- Date: Wed, 8 Jan 2014 00:41:51 -0800
On 1/6/14, Vadim Peretokin <vperetokin@gmail.com> wrote:
> I'm getting the 'Interrupted system call' on OSX 10.8.5 while trying to
> read from io.popen within an application that embeds Lua. The same code
> works fine in the Lua interpreter:
>
> function listfonts()
> local f = io.popen([[python -c "import Cocoa
> manager = Cocoa.NSFontManager.sharedFontManager()
> font_families = list(manager.availableFontFamilies())
>
> for font in font_families:
> print font"]])
>
> if not f then return nil, "Python code to retrieve installed fonts
> didn't work" end
>
> local fonts = {}
> for font in f:lines() do
> fonts[#fonts+1] = font
> end
>
> f:close()
>
> return fonts
> end
>
>
> Lua was installed from Homebrew and linked via pkg-config which gives
> -L/usr/local/lib -llua -lm as the flags it used I tried compiling the
> application both via clang and gcc, same problem on both.
>
> This is something that comes up often, but there does not seem to be one
> agreedupon solution and I haven't been able to work this out.
>
> Any ideas?
>
Sorry, I don't know why you may be having problems with that, but
might I suggest trying LuaCocoa to skip the middleman?
#!/Library/Frameworks/LuaCocoa.framework/Versions/Current/Tools/luacocoa
LuaCocoa.import("Cocoa")
function listfonts()
local manager = NSFontManager:sharedFontManager()
local font_families = manager:availableFontFamilies()
for i=1, #font_families do
print(font_families[i])
end
end
listfonts()
-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/