xmake
xmake copied to clipboard
stdio重定向问题
Discussed in https://github.com/xmake-io/xmake/discussions/4527
Originally posted by Noroby December 21, 2023
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时重定向了输入,但是运行程序时不会输出到终端?
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
Bot detected the issue body's language is not English, translate it automatically.
Title: stdio redirection problem