@@ -53,24 +53,24 @@ def wsl_drive_map(string_to_map):
5353
5454# Replace Windows path with WSL supported path
5555for idx , cli_arg in enumerate (cli_args ):
56+ windows_file_path = cli_arg
5657
5758 if idx != 0 and cli_args [idx - 1 ] == '-f' :
5859 compose_file = cli_arg
5960 compose_file_name = os .path .basename (compose_file )
60- tmp_compose_file = os .path .join (compose_file_tmp_dir , compose_file_name )
61+ windows_file_path = os .path .join (compose_file_tmp_dir , compose_file_name )
6162
6263 if os .path .isfile (compose_file ):
6364 compose_file_content = pathlib .Path (compose_file ).read_text ()
6465 new_compose_file_content = wsl_drive_map (compose_file_content )
65- pathlib .Path (tmp_compose_file ).write_text (new_compose_file_content )
66+ pathlib .Path (windows_file_path ).write_text (new_compose_file_content )
6667 else :
6768 sys .stderr .write ('The PyCharm docker-compose file "{0}" does not exists, exiting...' .format (
6869 compose_file ))
6970 raise SystemExit (1 )
7071
71- compose_file_mapped = wsl_drive_map (tmp_compose_file )
72- docker_compose_cli_args += '{0} ' .format (compose_file_mapped )
73-
72+ if os .path .exists (windows_file_path ):
73+ docker_compose_cli_args += '{0} ' .format (wsl_drive_map (windows_file_path ))
7474 else :
7575 docker_compose_cli_args += '{0} ' .format (cli_arg )
7676
@@ -85,4 +85,9 @@ def wsl_drive_map(string_to_map):
8585print ('The docker-compose command was: {0}' .format (' ' .join (docker_compose_cmd )))
8686
8787# Run the docker-compose binary in bash on WSL with the appropriate argument(s)
88- subprocess .run (docker_compose_cmd , shell = True )
88+ docker_compose_process = subprocess .Popen (docker_compose_cmd , shell = True )
89+
90+ try :
91+ docker_compose_process .wait ()
92+ except KeyboardInterrupt :
93+ docker_compose_process .terminate ()
0 commit comments