mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
feat: 分离结果输出和日志
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/shadow1ng/fscan/Common"
|
||||
"github.com/shadow1ng/fscan/Core"
|
||||
"os"
|
||||
@@ -8,12 +9,17 @@ import (
|
||||
|
||||
func main() {
|
||||
Common.InitLogger()
|
||||
defer Common.CloseLogger() // 确保程序退出时关闭日志文件
|
||||
|
||||
var Info Common.HostInfo
|
||||
Common.Flag(&Info)
|
||||
if err := Common.Parse(&Info); err != nil {
|
||||
os.Exit(1) // 直接退出即可,日志已经同步写入
|
||||
os.Exit(1)
|
||||
}
|
||||
// 初始化输出系统,如果失败则直接退出
|
||||
if err := Common.InitOutput(); err != nil {
|
||||
Common.LogError(fmt.Sprintf("初始化输出系统失败: %v", err))
|
||||
os.Exit(1) // 关键修改:初始化失败时直接退出
|
||||
}
|
||||
defer Common.CloseOutput()
|
||||
Core.Scan(Info)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user