Skip to content

Commit 22b3f43

Browse files
jet-logicjet-logic
authored andcommitted
winci64
1 parent 03f564d commit 22b3f43

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

runce/cli.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ class Tail(Main):
130130
p_close: str = ""
131131

132132
def start(self) -> None:
133+
import sys
134+
133135
if self.format == "no":
134136
hf = None
135137
else:
@@ -150,7 +152,14 @@ def start(self) -> None:
150152
stdout.buffer.write(tail_bytes(x[out], int(lines[0])))
151153
elif lines[0] > 0:
152154
# TODO: pythonify
153-
cmd = ["tail", "-n", str(int(lines[0])), x[out]]
155+
if sys.platform.startswith("win"):
156+
cmd = [
157+
"powershell",
158+
"-c",
159+
f"Get-Content -Tail {int(lines[0])} '{x[out]}'",
160+
]
161+
else:
162+
cmd = ["tail", "-n", str(int(lines[0])), x[out]]
154163
if self.tab:
155164
with Popen(cmd, stdout=PIPE).stdout as o:
156165
for line in o:

0 commit comments

Comments
 (0)