munit
munit copied to clipboard
Loading module munit_logging breaks munit
Module munit_logging breaks munit when the system temp directory is set to anything other than appdata/local/temp .
Steps to reproduce:
- Set environment variable "TEMP" (in the traceback below "c:/windows/temp")
- Load module munit_logging
- Run any testcase
- Traceback:
**** Error: Access denied to c:\windows\Smallworld\munit_log.json
file_no_access(function="open file", filename="c:\windows\Smallworld\munit_log.json")
---- traceback: Alchemy-REPL (light_thread 26381049) ----
time=20/07/2019 20:28:25
sw!version=5.2.0.0 (swaf)
os_text_encoding=cp1252
!snapshot_traceback?!=unset
condition.raise() (sys_src/guts/condition.magik:616)
system.file_error() (sys_src/guts/system.magik:1425)
system.prim() (sys_src/guts/system.magik:1753)
system.sys!open_file_output() (sys_src/guts/system.magik:633)
external_text_simple_output_stream.new_appending() (sys_src/streams_external/external_text_simple_output_stream.magik:47)
simple_file_log.new_file_appending() (modules/sw_core/logging/source/simple_file_log.magik:61)
munit_log.new_json_log() (modules\munit_logging\source\munit_log.magik:134)
munit_log.new_json_logging_framework() (modules\munit_logging\source\munit_log.magik:113)
munit_log.get_logger() (modules\munit_logging\source\munit_log.magik:95)
Responsible code:
_pragma(classify_level=restricted, usage={redefinable}, topic={logging})
## Defines the filename and path for the migration log
munit_log.define_shared_constant(:log_filepath,
system.pathname_down(
system.pathname_down(system.pathname_up(system.temp_directory_name), "Smallworld"),
"munit_log.json"),
:private)
$
Proposed fix:
_pragma(classify_level=restricted, usage={redefinable}, topic={logging})
## Defines the filename and path for the migration log
munit_log.define_shared_constant(:log_filepath,
system.temp_file_name("munit_log.json"),
:private)
$