Skip to content

Commit 3e241e1

Browse files
authored
Fix incorrect timestamp in raw data output file names when running all scanners with -r option (#160)
* fix incorrect date generation in raw_data filename * style(scanner): remove comments --------- Signed-off-by: hyesung <hyesung.choi@lge.com>
1 parent 6881b34 commit 3e241e1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SPDX-License-Identifier: Apache-2.0
2424
[rule]: https://oss.lge.com/guide/process/osc_process/1-identification/copyright_license_rule.html
2525

2626
## Contents
27-
27+
Please refer to https://fosslight.org/fosslight-guide/scanner/ for the FOSSLight Scanner User Guide.
2828
- [FOSSLight Scanner](#fosslight-scanner)
2929
- [Contents](#contents)
3030
- [📋 Prerequisite](#-prerequisite)

src/fosslight_scanner/fosslight_scanner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import shlex
1414
import subprocess
1515
import platform
16+
import time
1617
from pathlib import Path
1718
from datetime import datetime
1819

@@ -196,6 +197,8 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
196197

197198
if success:
198199
if run_src:
200+
original_tz = os.environ.get('TZ')
201+
199202
try:
200203
if fosslight_source_installed:
201204
src_output = _output_dir
@@ -232,6 +235,12 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
232235

233236
except Exception as ex:
234237
logger.warning(f"Failed to run source analysis: {ex}")
238+
finally:
239+
if original_tz:
240+
os.environ['TZ'] = original_tz
241+
elif 'TZ' in os.environ:
242+
del os.environ['TZ']
243+
time.tzset()
235244

236245
if run_bin:
237246
success, result = call_analysis_api(src_path, "Binary Analysis",

0 commit comments

Comments
 (0)