diff options
| author | ruki <[email protected]> | 2022-04-16 20:44:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-16 20:44:26 +0800 |
| commit | c50be9dc24299bdd05fc024dd726b5199a2f6f7d (patch) | |
| tree | fcfc3cc03e200ed0b3c191c984ed0b31c09903cf /xmake/modules | |
| parent | 838e53f354b121da72c3fc51efd1e44f876adfa1 (diff) | |
improve to start server
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/service/start_service.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/modules/private/service/start_service.lua b/xmake/modules/private/service/start_service.lua index f9dd357df..d24ec242a 100644 --- a/xmake/modules/private/service/start_service.lua +++ b/xmake/modules/private/service/start_service.lua @@ -49,7 +49,23 @@ function main(opt) os.mkdir(logdir) end end - os.execv(os.programfile(), argv, {detach = true, stdout = logfile, stderr = logfile}) + local tmpdir = os.tmpfile() .. ".dir" + if not os.isdir(tmpdir) then + os.mkdir(tmpdir) + end + try + { + function() + os.execv(os.programfile(), argv, {detach = true, curdir = tmpdir, stdout = logfile, stderr = logfile}) + end, + catch + { + function (errors) + io.cat(logfile) + raise(errors) + end + } + } else service() end |
