Skip to content

Commit

Permalink
Use buffered stdin/stdout, increment version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdelorenzo committed Nov 8, 2020
1 parent 7b1e6d9 commit 041bfd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions onhold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from sys import stdin, stdout, exit, stderr
from pathlib import Path
from os import environ
import sys
import subprocess
from subprocess import run

from play_sounds import DEFAULT_SONG
from detect import unix as IS_UNIX
Expand All @@ -14,7 +13,7 @@
RC_OK = 0
RC_ENV_VAR = 1
ENV_VAR = 'ONHOLD'
BLOCK_WHILE_PLAYING = True
PIPE_CMD = 'cat'


def is_pipeline() -> bool:
Expand All @@ -23,16 +22,16 @@ def is_pipeline() -> bool:

def dumb_pipe():
if IS_UNIX:
# if we're on unix, just redirect via shell
subprocess.run(
"cat",
# if we're on unix, redirect via shell
run(
PIPE_CMD,
shell=True,
stdin=stdin,
stdout=stdout
stdin=stdin.buffer,
stdout=stdout.buffer
)

else:
# if we're on windows, iterate over stdin
# if we're some other platform, iterate over stdin
stdout.buffer.writelines(stdin.buffer)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


NAME = "onhold"
VERSION = "0.4.0"
VERSION = "0.4.1"
LICENSE = "AGPL-3.0"

DESC = "🔊 Play music while and after jobs complete"
Expand Down

0 comments on commit 041bfd1

Please sign in to comment.