Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
win_ssh_cmd Namespace Reference

Functions

 main (user_host, cmd, fail_errorlevel)
 

Variables

str SENTINEL = 'win_ssh_cmd remote command successful'
 
 file
 
int arg_fail_errorlevel = 1 if len(sys.argv) < 4 else sys.argv[3]
 

Function Documentation

◆ main()

win_ssh_cmd.main (   user_host,
  cmd,
  fail_errorlevel 
)

Definition at line 23 of file win_ssh_cmd.py.

23def main(user_host, cmd, fail_errorlevel):
24 ssh_cmd = ['ssh', '-oConnectTimeout=15', '-oBatchMode=yes', user_host,
25 '(' + cmd + ') & if not errorlevel %s echo %s' % (
26 fail_errorlevel, SENTINEL)]
27 # True if we saw a line matching SENTINEL.
28 saw_sentinel = False
29 print('Original command:\n%s\nFull command:\n%s' % (
30 cmd, ' '.join([repr(s) for s in ssh_cmd])), file=sys.stderr)
31 proc = subprocess.Popen(ssh_cmd, stdout=subprocess.PIPE)
32 for line in iter(proc.stdout.readline, ''):
33 stripped = line.strip()
34 if stripped == SENTINEL:
35 saw_sentinel = True
36 else:
37 print(stripped)
38 proc.wait()
39 sys.stdout.flush()
40 if proc.returncode != 0:
41 sys.exit(proc.returncode)
42 if not saw_sentinel:
43 sys.exit(1)
44 sys.exit(0)
45
46
void print(void *str)
Definition bridge.cpp:126
Definition main.py:1

Variable Documentation

◆ arg_fail_errorlevel

int win_ssh_cmd.arg_fail_errorlevel = 1 if len(sys.argv) < 4 else sys.argv[3]

Definition at line 52 of file win_ssh_cmd.py.

◆ file

win_ssh_cmd.file

Definition at line 50 of file win_ssh_cmd.py.

◆ SENTINEL

str win_ssh_cmd.SENTINEL = 'win_ssh_cmd remote command successful'

Definition at line 20 of file win_ssh_cmd.py.