xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.65k stars 765 forks source link

stdio重定向问题 #4546

Open waruqi opened 7 months ago

waruqi commented 7 months ago

Discussed in https://github.com/xmake-io/xmake/discussions/4527

Originally posted by **Noroby** December 21, 2023 ```lua add_rules("mode.debug", "mode.release") target("main") set_kind("binary") add_files("src/*.cpp") set_toolchains("clang") set_languages("cxx20") on_run(function(target) os.execv(target:targetfile(), {}, {stdin = "input.txt"}) end) ``` 我执行execv时重定向了输入,但是运行程序时不会输出到终端?
waruqi commented 7 months ago

win 下才有的问题,这个地方导致 https://github.com/tboox/tbox/blob/059f19ed8f18cfcd59c1ca2f2aff3143157a0df4/src/tbox/platform/windows/process.c#L489

但是目前没有很好的办法解决,这块涉及很多细节东西 https://github.com/xmake-io/xmake/issues/3138#issuecomment-1338970250

Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: stdio redirection problem