github.com/google/fleetspeak@v0.1.15-0.20240426164851-4f31f62c1aea/fleetspeak_python/fleetspeak/client_connector/testing/testclient_launcher.py (about) 1 #!/usr/bin/env python 2 # Copyright 2018 Google Inc. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # https://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 """Script that launches testclient.Loopback in another process.""" 17 18 import subprocess 19 20 from absl import app 21 22 23 def main(argv=None): 24 del argv 25 p = subprocess.Popen( 26 [ 27 "python", 28 "-m", 29 "fleetspeak.client_connector.testing.testclient", 30 "--", 31 "--mode=loopback", 32 ], 33 # Make sure file descriptors passed from the parent Fleetspeak process are 34 # not closed. This is critical for inter-process communication between 35 # the Fleetspeak client and the test client. 36 close_fds=False, 37 ) 38 p.communicate() 39 p.wait() 40 41 42 if __name__ == "__main__": 43 app.run(main)