@@ -59,41 +59,52 @@ namespace shellanything
5959{
6060 namespace test
6161 {
62- void KillShellAnythingArgumentsDebuggerProcess ()
62+ inline std::string GetArgumentsDebuggerFileName ()
6363 {
64- printf (" Killing all arguments.debugger.window.exe processes...\n " );
65-
64+ std::string name;
6665 if (ra::environment::IsConfigurationDebug ())
67- system ( " cmd.exe /c taskkill /IM arguments.debugger.window-d.exe >NUL 2>NUL " ) ;
66+ name = " arguments.debugger.window-d.exe" ;
6867 else
69- system (" cmd.exe /c taskkill /IM arguments.debugger.window.exe >NUL 2>NUL" );
68+ name = " arguments.debugger.window.exe" ;
69+ return name;
70+ }
71+
72+ void KillArgumentsDebuggerProcess ()
73+ {
74+ // Build exec name
75+ std::string exec_file_name = GetArgumentsDebuggerFileName ();
76+
77+ printf (" Killing all '%s' processes...\n " , exec_file_name.c_str ());
78+
79+ char command[1024 ] = { 0 };
80+ sprintf_s (command, sizeof (command), " cmd.exe /c taskkill /IM %s >NUL 2>NUL" , exec_file_name.c_str ());
81+ system (command);
7082
7183 ra::timing::Millisleep (1000 );
7284
7385 printf (" killed.\n " );
7486 }
7587
76- bool StartShellAnythingArgumentsDebuggerProcess (ra::process::processid_t & pId)
88+ bool StartArgumentsDebuggerProcess (ra::process::processid_t & pId)
7789 {
78- printf (" Starting arguments.debugger.window.exe...\n " );
90+ // Build exec name
91+ std::string exec_file_name = GetArgumentsDebuggerFileName ();
92+
93+ printf (" Starting %s...\n " , exec_file_name.c_str ());
7994
8095 // Build path of arguments.debugger.window.exe
8196 std::string current_process_dir = ra::process::GetCurrentProcessDir ();
82- std::string process_path;
83- if (ra::environment::IsConfigurationDebug ())
84- process_path = current_process_dir + " \\ arguments.debugger.window-d.exe" ;
85- else
86- process_path = current_process_dir + " \\ arguments.debugger.window.exe" ;
97+ std::string exec_path = current_process_dir + " \\ " + exec_file_name;
8798
8899 // Assert that file exists
89- if (!ra::filesystem::FileExists (process_path .c_str ()))
100+ if (!ra::filesystem::FileExists (exec_path .c_str ()))
90101 {
91- printf (" Start process failed. File not found: '%s'.\n " , process_path .c_str ());
102+ printf (" Start process failed. File not found: '%s'.\n " , exec_path .c_str ());
92103 return false ;
93104 }
94105
95106 // Start the actual process
96- ra::process::processid_t tmp_pid = ra::process::StartProcess (process_path , current_process_dir.c_str ());
107+ ra::process::processid_t tmp_pid = ra::process::StartProcess (exec_path , current_process_dir.c_str ());
97108
98109 // Asser created properly
99110 if (tmp_pid == 0 )
0 commit comments