Skip to content

Commit 041bfd1

Browse files
author
alexdelorenzo
committed
Use buffered stdin/stdout, increment version
1 parent 7b1e6d9 commit 041bfd1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

onhold/base.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from sys import stdin, stdout, exit, stderr
44
from pathlib import Path
55
from os import environ
6-
import sys
7-
import subprocess
6+
from subprocess import run
87

98
from play_sounds import DEFAULT_SONG
109
from detect import unix as IS_UNIX
@@ -14,7 +13,7 @@
1413
RC_OK = 0
1514
RC_ENV_VAR = 1
1615
ENV_VAR = 'ONHOLD'
17-
BLOCK_WHILE_PLAYING = True
16+
PIPE_CMD = 'cat'
1817

1918

2019
def is_pipeline() -> bool:
@@ -23,16 +22,16 @@ def is_pipeline() -> bool:
2322

2423
def dumb_pipe():
2524
if IS_UNIX:
26-
# if we're on unix, just redirect via shell
27-
subprocess.run(
28-
"cat",
25+
# if we're on unix, redirect via shell
26+
run(
27+
PIPE_CMD,
2928
shell=True,
30-
stdin=stdin,
31-
stdout=stdout
29+
stdin=stdin.buffer,
30+
stdout=stdout.buffer
3231
)
3332

3433
else:
35-
# if we're on windows, iterate over stdin
34+
# if we're some other platform, iterate over stdin
3635
stdout.buffer.writelines(stdin.buffer)
3736

3837

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
NAME = "onhold"
7-
VERSION = "0.4.0"
7+
VERSION = "0.4.1"
88
LICENSE = "AGPL-3.0"
99

1010
DESC = "🔊 Play music while and after jobs complete"

0 commit comments

Comments
 (0)