popen -> run

This commit is contained in:
AF 2020-08-23 00:03:46 +03:00
parent ab311c54d8
commit ee4a6865d8

View File

@ -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()