From 6e6cf755b207fe128e6e8a534d3df15f56d9c8a4 Mon Sep 17 00:00:00 2001 From: Saikari Date: Tue, 27 Jan 2026 05:45:37 +0300 Subject: refactor tty.shell to use os.tmpfile and os.runv for improved file handling --- xmake/core/base/tty.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmake/core/base/tty.lua b/xmake/core/base/tty.lua index 51c301ab4..27788419b 100644 --- a/xmake/core/base/tty.lua +++ b/xmake/core/base/tty.lua @@ -263,8 +263,8 @@ function tty.shell() for i = 1, 10 do local stat = io.readfile("/proc/" .. pid .. "/stat") if not stat or #stat == 0 then - local tmpfile = path.join(os.tmpdir(), "xmake_stat_" .. os.getpid()) - os.execv("cp", {"/proc/" .. pid .. "/stat", tmpfile}) + local tmpfile = os.tmpfile() + os.runv("cp", {"/proc/" .. pid .. "/stat", tmpfile}) stat = io.readfile(tmpfile) os.rm(tmpfile) end @@ -299,8 +299,8 @@ function tty.shell() if not shell_path and os.isfile("/proc/" .. ppid .. "/comm") then shell_name = io.readfile("/proc/" .. ppid .. "/comm") if not shell_name or #shell_name == 0 then - local tmpfile = path.join(os.tmpdir(), "xmake_comm_" .. os.getpid()) - os.execv("cp", {"/proc/" .. ppid .. "/comm", tmpfile}) + local tmpfile = os.tmpfile() + os.runv("cp", {"/proc/" .. ppid .. "/comm", tmpfile}) shell_name = io.readfile(tmpfile) os.rm(tmpfile) end -- cgit v1.3.1