diff options
| -rw-r--r-- | xmake/core/base/os.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 62b0c34de..099ceb799 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -764,8 +764,6 @@ function os.iorunv(program, argv, opt) -- remove the temporary output and error file os.rm(outfile) os.rm(errfile) - - -- ok? return ok == 0, outdata, errdata, errors end diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index a2cd2105e..51cc45e69 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -55,12 +55,11 @@ function sandbox_lib_detect_find_program._check(program, opt) -- no check script? attempt to run it directly if not opt.check then - local stdout, stderr - if not option.get("diagnosis") then - stdout = os.nuldev() - stderr = os.nuldev() + local ok, errors = os.runv(program, {"--version"}, {envs = opt.envs}) + if not ok and option.get("diagnosis") then + utils.cprint("${color.warning}checkinfo: ${clear dim}" .. errors) end - return 0 == os.execv(program, {"--version"}, {stdout = stdout, stderr = stderr, envs = opt.envs}) + return ok end -- check it |
