Skip to content

Commit 6171d1f

Browse files
fix: improve error visibility and adapter.run() parameter passing
- Enhanced error display for skipped checks in dev mode - Show error details (type and value) for checks with passed=None - Fixed adapter.run() to build command string with args properly - Resolved ValueError when passing command-line arguments to programs - Applied fix to both CompiledLanguageAdapter and InterpretedLanguageAdapter
1 parent 557cd34 commit 6171d1f

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

bootcs/__main__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ def output_ansi(results, show_log=False):
354354

355355
termcolor.cprint(f"{emoji} {result.description}", color)
356356

357+
# Show cause for failed checks (passed=False)
357358
if result.cause and result.passed is False:
358359
rationale = result.cause.get("rationale", "")
359360
if rationale:
@@ -362,6 +363,18 @@ def output_ansi(results, show_log=False):
362363
if help_msg:
363364
termcolor.cprint(f" 💡 {help_msg}", "cyan")
364365

366+
# In dev mode or with --log, also show error info for skipped checks (passed=None)
367+
if result.cause and result.passed is None and show_log:
368+
error_info = result.cause.get("error")
369+
if error_info:
370+
error_type = error_info.get("type", "Error")
371+
error_value = error_info.get("value", "")
372+
termcolor.cprint(f" ⚠️ {error_type}: {error_value}", "yellow")
373+
else:
374+
rationale = result.cause.get("rationale", "")
375+
if rationale and rationale != "can't check until a frown turns upside down":
376+
termcolor.cprint(f" ⚠️ {rationale}", "yellow")
377+
365378
if show_log and result.log:
366379
print(" Log:")
367380
for line in result.log:

bootcs/check/adapters/compiled.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ def run(self, *args, stdin=None, **kwargs) -> object:
123123
# e.g., hello.c -> hello
124124
from .. import _api
125125
exe_name = source_file.stem
126-
return _api.run(f"./{exe_name}", *args)
126+
# Build command string with arguments
127+
command = f"./{exe_name}"
128+
if args:
129+
command += " " + " ".join(str(arg) for arg in args)
130+
return _api.run(command)
127131
elif self.language == 'java':
128132
# Use existing Java runner
129133
return java.run(str(source_file), *args)
@@ -195,10 +199,17 @@ def run(self, *args, stdin=None, **kwargs) -> object:
195199

196200
if self.language in ('python', 'py'):
197201
from .. import _api
198-
return _api.run(f"python3 {source_file}", *args)
202+
# Build command string with arguments
203+
command = f"python3 {source_file}"
204+
if args:
205+
command += " " + " ".join(str(arg) for arg in args)
206+
return _api.run(command)
199207
elif self.language in ('javascript', 'js'):
200208
from .. import _api
201-
return _api.run(f"node {source_file}", *args)
209+
command = f"node {source_file}"
210+
if args:
211+
command += " " + " ".join(str(arg) for arg in args)
212+
return _api.run(command)
202213
else:
203214
raise NotImplementedError(
204215
f"Execution not yet implemented for language: {self.language}"

0 commit comments

Comments
 (0)