Skip to content

Commit 779bc03

Browse files
committed
add console prints for detection type change method
1 parent a14ca72 commit 779bc03

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎ileappGUI.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def open_report(report_path):
216216
def open_lava(project_path, launcher):
217217
'''Open the generated project in LAVA and quit after processing completed.'''
218218
try:
219-
open_lava_project(project_path, launcher)
219+
open_lava_project(project_path, launcher, logfunc)
220220
except (OSError, ValueError) as ex:
221221
tk_msgbox.showerror(
222222
title='Unable to open LAVA',

‎leapp_functions/lava_launcher.py‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,34 @@ def find_lava_launcher(project_path):
161161
return None
162162

163163

164-
def open_lava_project(project_path, launcher):
164+
def open_lava_project(project_path, launcher, log=print):
165165
"""Open a LEAPP project using a launcher returned by find_lava_launcher."""
166166

167167
launcher_type, launcher_value = launcher
168+
log(
169+
f"LAVA launcher: type={launcher_type!r}, value={launcher_value!r}, "
170+
f"project={project_path!r}"
171+
)
168172
if launcher_type == "executable":
169173
if sys.platform == "win32":
170-
os.startfile(
171-
launcher_value,
172-
arguments=subprocess.list2cmdline([project_path]),
174+
log("LAVA detected as executable")
175+
subprocess.Popen(
176+
[launcher_value, project_path],
177+
stdin=subprocess.DEVNULL,
178+
stdout=subprocess.DEVNULL,
179+
stderr=subprocess.DEVNULL,
180+
close_fds=True,
181+
creationflags=(
182+
subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS
183+
),
173184
)
174185
else:
175186
subprocess.Popen([launcher_value, project_path])
176187
elif launcher_type == "application":
188+
log("LAVA detected as application")
177189
subprocess.Popen(["open", "-a", launcher_value, project_path])
178190
elif launcher_type == "association":
191+
log("LAVA detected as association")
179192
if sys.platform == "win32":
180193
os.startfile(project_path)
181194
else:

‎scripts/ilapfuncs.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
import scripts.artifact_report as artifact_report
2222
from scripts.context import Context
2323

24+
25+
_console_write = sys.stdout.write
26+
2427
# common third party imports
2528
import pytz
2629
import simplekml
@@ -138,6 +141,7 @@ def set_values(self, media_ref_info):
138141

139142
def logfunc(message=""):
140143
def redirect_logs(string):
144+
_console_write(string)
141145
log_text.insert('end', string)
142146
log_text.see('end')
143147
log_text.update()

0 commit comments

Comments
 (0)