mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
update python invokeLocal to detect tty
This commit is contained in:
parent
00daa75956
commit
de4e6d82a3
@ -1,3 +1,4 @@
|
||||
import subprocess
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
@ -69,7 +70,12 @@ if __name__ == '__main__':
|
||||
|
||||
input = json.load(sys.stdin)
|
||||
if sys.platform != 'win32':
|
||||
sys.stdin = open('/dev/tty')
|
||||
tty = subprocess.run('tty')
|
||||
if tty.returncode == 0:
|
||||
sys.stdin = open('/dev/tty')
|
||||
else:
|
||||
print('No TTY found. Ignoring')
|
||||
|
||||
context = FakeLambdaContext(**input.get('context', {}))
|
||||
result = handler(input['event'], context)
|
||||
sys.stdout.write(json.dumps(result, indent=4))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user