__main__.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (c) Microsoft Corporation.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import subprocess
  15. import sys
  16. from playwright._impl._driver import compute_driver_executable, get_driver_env
  17. def main() -> None:
  18. try:
  19. driver_executable, driver_cli = compute_driver_executable()
  20. completed_process = subprocess.run(
  21. [driver_executable, driver_cli, *sys.argv[1:]], env=get_driver_env()
  22. )
  23. sys.exit(completed_process.returncode)
  24. except KeyboardInterrupt:
  25. sys.exit(130)
  26. if __name__ == "__main__":
  27. main()