Merge pull request #5 from stromnet/cleanup-fix

Cleanup fix
This commit is contained in:
Andris Raugulis
2018-09-06 17:07:14 +03:00
committed by GitHub
+6 -2
View File
@@ -24,7 +24,7 @@
THE SOFTWARE.
"""
from __future__ import print_function
import io, os, sys, re, json, base64, getpass, subprocess, shlex
import io, os, sys, re, json, base64, getpass, subprocess, shlex, signal
from lxml import etree
import requests
@@ -361,8 +361,12 @@ def main():
cmd = shlex.split(cmd)
cmd = [os.path.expandvars(os.path.expanduser(x)) for x in cmd]
pp = subprocess.Popen(shlex.split(pcmd), stdout=subprocess.PIPE)
cp = subprocess.Popen(cmd, stdin=pp.stdout, stdout=subprocess.PIPE)
cp = subprocess.Popen(cmd, stdin=pp.stdout, stdout=sys.stdout)
pp.stdout.close()
# Do not abort on SIGINT. openconnect will see it, and perform proper exit & cleanup
signal.signal(signal.SIGINT, signal.SIG_IGN)
cp.communicate()
else:
print('{0} | {1}'.format(pcmd, cmd))