Old 07-14-2016, 07:29 PM   #1
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,484
Default Lua bug: io.popen returns nil in REAPER x32

Code:
result={}
file = io.popen("dir")
if file then 
  for line in file:lines() do
    table.insert(result, line)
  end
  file:close()
  for f,g in ipairs(result) do
    reaper.ShowConsoleMsg(g .. "\n")
  end
else
  reaper.ShowConsoleMsg("return nil")
end
This code works in REAPERx64, windows x64. But it always returns nil in REAPERx32, windows x64.
heda is offline   Reply With Quote
Old 07-14-2016, 07:47 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,832
Default

I can confirm this. io.popen returns nil, "dir: no error", 0 with REAPER 32-bit on Windows 64-bit. (I've also tested with REAPER 32-bit on OS X, it works there)
cfillion is online now   Reply With Quote
Old 07-14-2016, 08:14 PM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,488
Default

Hmm I think there are some reasons not to use io.popen() on Windows, but I forget...
Justin is offline   Reply With Quote
Old 07-14-2016, 08:20 PM   #4
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,484
Default

I use it to return a list of script files in a directory.

Code:
commanddir='dir /b "'..directory..'\\*.lua" "'..directory..'\\*.eel"'
file = io.popen(commanddir)
It's a bit of a hack. If there is another way I would be happy to know. Because using io.popen opens a command window that can be seen and quickly closes. So it seems strange to the user.
heda is offline   Reply With Quote
Old 10-21-2019, 10:20 AM   #5
akademie
Human being with feelings
 
Join Date: Mar 2007
Posts: 568
Default

So what is the verdict, please ???
There are lots of scripts that use this "io.popen" and they are of no use as they do not work on Windows 32-bit versions... :-(
???
akademie is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.