mirror of
https://github.com/romanz/amodem.git
synced 2026-02-07 01:18:02 +08:00
24 lines
505 B
Python
24 lines
505 B
Python
from amodem import wave
|
|
import subprocess as sp
|
|
import signal
|
|
|
|
|
|
def test_launch():
|
|
p = wave.launch('cat', stdin=sp.PIPE)
|
|
p.stdin.close()
|
|
assert p.wait() == 0
|
|
|
|
p = wave.launch('bash', stdin=sp.PIPE)
|
|
p.stdin.write(b'exit 42')
|
|
p.stdin.close()
|
|
assert p.wait() == 42
|
|
|
|
p = wave.launch('cat', stdin=sp.PIPE, stdout=sp.PIPE)
|
|
s = b'Hello World!'
|
|
p.stdin.write(s)
|
|
p.stdin.flush()
|
|
assert p.stdout.read(len(s)) == s
|
|
|
|
p.kill()
|
|
assert p.wait() == -signal.SIGKILL
|