On Sat, Nov 23, 2024 at 01:33:52AM -0800, Gerrit Sangel wrote:
> On the other hand, this is not an unfixable problem, because other
> programming languages/their runtimes (as mentioned, I've went a bit through
> the Rust's source code) use different Win32 APIs which do _not_ create any
> terminal window in this case (for example,
>
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw).
>
> I would say a proper fix for every application is to replace the default
> Lua implementations for these two functions with functions which use the
> proper Win32 APIs... But then this issue is only solved in one application,
> it increases maintainably effort and I think this is actually a bug in the
> Lua runtime implementation. So I'm just wondering if there is a reason for
> the current implementation,
Lua itself is a quite small language. As you can see, its standard
library is mostly derived from ISO C. Thus I think it's just no one
would like to make use of non-standard API in such a project in order to
work around a platform-specific "bug". It's kind of dirty, at least to
me.
And I don't even think it should be called a "bug". This is how Lua
manual describes os.execute(),
This function is equivalent to the ISO C function system. It
passes command to be executed by an operating system shell.
So it's expected that os.execute() does nothing different from system()
in C.
> or just because nobody found an
> opportunity/necessity to improve it yet, and whether it makes sense to
> improve this in the default Lua runtime.
IMHO, it's not always an improvement, maybe there're applications
depending on a working stdin/stdout?
Lua focuses on its core functionality as a script language, delegating
platform-specific operations completely to C library instead of
unifiying implementation details ;)
Best regards,
Yao Zi