From ee4a6865d8903c91cdd25a2cbe20feaf59be3ebc Mon Sep 17 00:00:00 2001 From: timotheyca Date: Sun, 23 Aug 2020 00:03:46 +0300 Subject: [PATCH] popen -> run --- v25/storage/dbstorage.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/v25/storage/dbstorage.py b/v25/storage/dbstorage.py index cd8f756..47fcf57 100644 --- a/v25/storage/dbstorage.py +++ b/v25/storage/dbstorage.py @@ -1,5 +1,5 @@ import json -from subprocess import Popen, PIPE +from subprocess import run from sys import stderr from threading import Thread from time import time, sleep @@ -342,16 +342,14 @@ class DBStorage(PushStorage): @staticmethod def pushsubscription(subscription: dict): - p = Popen(["node", "v25pushx/push.js"], stdin=PIPE, shell=True) - p.communicate(json.dumps({ + assert run(["node", "v25pushx/push.js"], input=json.dumps({ "subscription": subscription, "notification": { "notification": { "title": "New Message (V25PUSH)" } } - }).encode()) - assert not p.wait(), "push subprocess failed" + })).returncode, "push subprocess failed" def pushpush(self, subject: Subject): session = self.Session()