mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
handle platforms that don't support termios (#1652)
This commit is contained in:
@@ -78,7 +78,11 @@ import struct
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from tempfile import TemporaryFile
|
from tempfile import TemporaryFile
|
||||||
import termios
|
try:
|
||||||
|
import termios
|
||||||
|
except ImportError:
|
||||||
|
# termios does not exist for Windows
|
||||||
|
pass
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
@@ -4479,6 +4483,7 @@ def runSqliteQuery(db_file, query):
|
|||||||
return curr.fetchone()[0]
|
return curr.fetchone()[0]
|
||||||
|
|
||||||
def refreshCredentialsWithReauth(credentials):
|
def refreshCredentialsWithReauth(credentials):
|
||||||
|
if 'termios' in sys.modules:
|
||||||
old_settings = termios.tcgetattr(sys.stdin)
|
old_settings = termios.tcgetattr(sys.stdin)
|
||||||
# First makes sure gcloud has a valid access token and thus
|
# First makes sure gcloud has a valid access token and thus
|
||||||
# should also have a valid RAPT token
|
# should also have a valid RAPT token
|
||||||
@@ -4494,6 +4499,7 @@ def refreshCredentialsWithReauth(credentials):
|
|||||||
capture_output=True)
|
capture_output=True)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# avoids loss of terminal echo on *nix
|
# avoids loss of terminal echo on *nix
|
||||||
|
if 'termios' in sys.modules:
|
||||||
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings)
|
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings)
|
||||||
printBlankLine()
|
printBlankLine()
|
||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
|
|||||||
Reference in New Issue
Block a user