# -*- coding: utf-8 -*-
"""只操作本程序创建的临时对象；全部数据为合成样本。"""
import os, sys, json, sqlite3, tempfile, pathlib, subprocess, time, socket, stat
from pathlib import Path
def emit(**kw):
    print(json.dumps(kw, ensure_ascii=False, sort_keys=True))
import shlex
argv=['demo-gateway','--config','demo.json','|','tee','demo.log']
direct=subprocess.check_output([sys.executable,'-c','import sys,json; print(json.dumps(sys.argv[1:]))']+argv[1:],universal_newlines=True)
parsed=json.loads(direct)
shell=subprocess.check_output('echo demo | '+('more' if os.name=='nt' else 'cat'),shell=True,universal_newlines=True).strip()
assert '|' in parsed and shell=='demo'
emit(direct_argv=parsed,shell_pipeline=shell,scope='直接argv与显式shell差异；未注册systemd服务')
