Skip to content

Commit 2b32ae0

Browse files
jet-logicjet-logic
authored andcommitted
id can also be process id
1 parent 43124e2 commit 2b32ae0

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

runce/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
Ensures each command runs exactly once per unique ID.
66
"""
77

8-
__version__ = "0.4.1"
8+
__version__ = "0.4.2"

runce/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def start(self) -> None:
214214
if e:
215215
s = ["🚨", r"Found: PID={pid} ({pid_status}) {name}"]
216216
else:
217+
217218
# Start new process
218219
e = sp.spawn(args, name, overwrite=self.overwrite, cwd=self.cwd, split=self.split, in_file=self.input)
219220
s = ["🚀", r"Started: PID={pid} ({pid_status}) {name}"]

runce/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ def look_multiple(
119119
exact.append(item)
120120
elif id in name:
121121
partial.append(item)
122+
elif id.isdigit():
123+
if item["pid"] == int(id):
124+
exact.append(item)
122125
for id, (exact, partial) in map_ids.items():
123126
if exact:
124127
if len(exact) > 1:

tests/echo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from sys import argv, stderr, stdout
22
from time import sleep
33

4+
name = argv[1]
45
where = argv[2] if len(argv) > 2 else "out"
56
stop = int(argv[3]) if len(argv) > 3 else 9
7+
68
file = stderr if where.startswith("e") else stdout
79

810
for i in range(stop):
9-
print(argv[1], i, flush=True, file=file)
11+
print(name, i, flush=True, file=file)
1012
sleep(2)

0 commit comments

Comments
 (0)