diff options
author | 2016-03-12 12:31:13 +0100 | |
---|---|---|
committer | 2016-03-12 12:31:13 +0100 | |
commit | a026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch) | |
tree | e31573822f2359677de519f9f3b600d98e8764cd /3rdparty/luv/tests/test-process.lua | |
parent | 477d2abd43984f076b7e45f5527591fa8fd0d241 (diff) | |
parent | dcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff) |
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to '3rdparty/luv/tests/test-process.lua')
-rw-r--r-- | 3rdparty/luv/tests/test-process.lua | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/3rdparty/luv/tests/test-process.lua b/3rdparty/luv/tests/test-process.lua deleted file mode 100644 index 4d2b6fbfdab..00000000000 --- a/3rdparty/luv/tests/test-process.lua +++ /dev/null @@ -1,101 +0,0 @@ -return require('lib/tap')(function (test) - - test("test disable_stdio_inheritance", function (print, p, expect, uv) - uv.disable_stdio_inheritance() - end) - - test("process stdout", function (print, p, expect, uv) - local stdout = uv.new_pipe(false) - - local handle, pid - handle, pid = uv.spawn(uv.exepath(), { - args = {"-e", "print 'Hello World'"}, - stdio = {nil, stdout}, - }, expect(function (code, signal) - p("exit", {code=code, signal=signal}) - uv.close(handle) - end)) - - p{ - handle=handle, - pid=pid - } - - uv.read_start(stdout, expect(function (err, chunk) - p("stdout", {err=err,chunk=chunk}) - assert(not err, err) - uv.close(stdout) - end)) - - end) - - if _G.isWindows then return end - - test("spawn and kill by pid", function (print, p, expect, uv) - local handle, pid - handle, pid = uv.spawn("sleep", { - args = {1}, - }, expect(function (status, signal) - p("exit", handle, {status=status,signal=signal}) - assert(status == 0) - assert(signal == 2) - uv.close(handle) - end)) - p{handle=handle,pid=pid} - uv.kill(pid, "sigint") - end) - - test("spawn and kill by handle", function (print, p, expect, uv) - local handle, pid - handle, pid = uv.spawn("sleep", { - args = {1}, - }, expect(function (status, signal) - p("exit", handle, {status=status,signal=signal}) - assert(status == 0) - assert(signal == 15) - uv.close(handle) - end)) - p{handle=handle,pid=pid} - uv.process_kill(handle, "sigterm") - end) - - test("invalid command", function (print, p, expect, uv) - local handle, err - handle, err = uv.spawn("ksjdfksjdflkjsflksdf", {}, function(exit, code) - assert(false) - end) - assert(handle == nil) - assert(err) - end) - - test("process stdio", function (print, p, expect, uv) - local stdin = uv.new_pipe(false) - local stdout = uv.new_pipe(false) - - local handle, pid - handle, pid = uv.spawn("cat", { - stdio = {stdin, stdout}, - }, expect(function (code, signal) - p("exit", {code=code, signal=signal}) - uv.close(handle) - end)) - - p{ - handle=handle, - pid=pid - } - - uv.read_start(stdout, expect(function (err, chunk) - p("stdout", {err=err,chunk=chunk}) - assert(not err, err) - uv.close(stdout) - end)) - - uv.write(stdin, "Hello World") - uv.shutdown(stdin, expect(function () - uv.close(stdin) - end)) - - end) - -end) |