Skip to content

Commit 03f564d

Browse files
jet-logicjet-logic
authored andcommitted
winci63
1 parent aeb8fcb commit 03f564d

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

runce/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def start(self) -> None:
150150
stdout.buffer.write(tail_bytes(x[out], int(lines[0])))
151151
elif lines[0] > 0:
152152
# TODO: pythonify
153-
cmd = ["tail", "-n", str(lines[0]), x[out]]
153+
cmd = ["tail", "-n", str(int(lines[0])), x[out]]
154154
if self.tab:
155155
with Popen(cmd, stdout=PIPE).stdout as o:
156156
for line in o:

tests/test_cli.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,29 @@ def test_kill(self):
7979
break
8080
print("check_pid", pid)
8181
sleep(1)
82-
83-
# print("", ch)
8482
o = self.run_runce("kill", "carrot")
8583
self.assertRegex(o, r"(?xim) \W+ no \W+ process \W+ .+ \W+ carrot (\W+|\Z)")
84+
o = self.run_runce("clean", "carrot")
85+
86+
def test_tail(self):
87+
o = self.run_runce(
88+
"run",
89+
"--id",
90+
"tomato",
91+
"--",
92+
"python",
93+
"-c",
94+
"for x in 'ABCD EFGH IJKL MNOP QRST UVWX YZ'.split(): print(x)",
95+
)
96+
self.assertRegex(o, r"(?xim) \W+ started: \W+ .+ \W+ tomato \W+")
97+
sleep(1)
98+
o = self.run_runce("tail", "-n", "3", "--header", "no", "tomato")
99+
self.assertRegex(o, r"(?xim) QRST \W+ UVWX \W+ YZ \W+ \Z")
100+
101+
o = self.run_runce("kill", "--remove", "tomato")
102+
self.assertRegex(
103+
o, r"(?xim) (?:\W+|\A) (?:killed|no\s+process) .+ \W+ tomato \W+"
104+
)
86105

87106
def test_cli(self):
88107

0 commit comments

Comments
 (0)