Skip to content

Commit

Permalink
Hide cmd window
Browse files Browse the repository at this point in the history
  • Loading branch information
zyazhb committed Apr 20, 2021
1 parent 1e2ec06 commit b15c0bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"time"

"log"
// "log"

"gorm.io/driver/sqlite"
"gorm.io/gorm"
Expand Down Expand Up @@ -53,7 +53,7 @@ func AddNewGame(gname string) {
currentTime := time.Now()
newgname := Gamedb{gamedb.GID + 1, gname, currentTime, currentTime, 0}
db.Create(&newgname)
log.Println("Successful add new game:", gname)
// log.Println("Successful add new game:", gname)
} else {
StartTime, _, _ := ShowTime(gname)
if StartTime.String() == "0001-01-01 00:00:00 +0000 UTC" {
Expand Down Expand Up @@ -84,7 +84,7 @@ func AddTotalTime(gname string) {
var gamedb Gamedb
db.Where("Name=?", gname).Find(&gamedb)
Totaltime := gamedb.TotalRun + gamedb.EndTime.Sub(gamedb.StartTime)
log.Printf(gamedb.EndTime.String() + gamedb.StartTime.String())
// log.Printf(gamedb.EndTime.String() + gamedb.StartTime.String())
db.Model(&gamedb).Where("Name=?", gname).Updates(map[string]interface{}{"TotalRun": Totaltime})
ClearTime(gname)
}
Expand Down
2 changes: 2 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import (
"os/exec"
"strconv"
"strings"
"syscall"
)

func isProcessExist(appName string) (bool, string, int) {
appary := make(map[string]int)
cmd := exec.Command("cmd", "/C", "tasklist")
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
output, _ := cmd.Output()
//fmt.Printf("fields: %v\n", output)
n := strings.Index(string(output), "System")
Expand Down

0 comments on commit b15c0bc

Please sign in to comment.