Skip to content

Commit c4c8266

Browse files
committed
Hide Extractor window on windows
Prevents window popping up when running the extractor
1 parent 97199a9 commit c4c8266

5 files changed

Lines changed: 32 additions & 6 deletions

File tree

cmd/openem-ingestor-app/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func main() {
7878
slog.Info("Config read", "Filepath", configFileReader.GetCurrentConfigFilePath())
7979

8080
slog.SetLogLoggerLevel(convertLogLevel(config.WebServer.LogLevel))
81+
slog.Info("Loglevel changed", "Loglevel", config.WebServer.LogLevel)
8182

8283
configData, _ := yaml.Marshal(configFileReader.GetFullConfig())
8384
println(string(configData))

internal/metadataextractor/extractor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ func runExtractor(ctx context.Context, executable string, args []string, stdoutC
389389

390390
cmd := exec.CommandContext(ctx, executable, args...)
391391

392+
hideWindow(cmd)
393+
392394
stdout, _ := cmd.StdoutPipe()
393395
stderr, _ := cmd.StderrPipe()
394396

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// syscall_other.go
2+
//go:build !windows
3+
4+
package metadataextractor
5+
6+
import "os/exec"
7+
8+
func hideWindow(cmd *exec.Cmd) {} // no-op
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// syscall_windows.go
2+
//go:build windows
3+
4+
package metadataextractor
5+
6+
import (
7+
"os/exec"
8+
"syscall"
9+
)
10+
11+
func hideWindow(cmd *exec.Cmd) {
12+
cmd.SysProcAttr = &syscall.SysProcAttr{
13+
HideWindow: true,
14+
CreationFlags: 0x08000000,
15+
}
16+
}

internal/ui/tasklist.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ type TaskDetails struct {
4646

4747
type taskRow struct {
4848
widget.BaseWidget
49-
task *transfertask.TransferTask
50-
folder *widget.Label
51-
// method *widget.Label
49+
task *transfertask.TransferTask
50+
folder *widget.Label
5251
status *widget.Label
5352
progress *widget.ProgressBar
5453
cancel *widget.Button
@@ -92,9 +91,9 @@ func (r *taskRow) Refresh() {
9291
r.status.Importance = widget.DangerImportance
9392
r.cancel.Disable()
9493
case transfertask.Transferring:
95-
mb := float64(d.BytesTransferred) / 1024 / 1024
96-
total := float64(d.BytesTotal) / 1024 / 1024
97-
r.status.SetText(fmt.Sprintf("Uploading %.1f / %.1f MB", mb, total))
94+
gb := float64(d.BytesTransferred) / 1024 / 1024 / 1024
95+
total := float64(d.BytesTotal) / 1024 / 1024 / 1024
96+
r.status.SetText(fmt.Sprintf("Uploading %.1f / %.1f GB", gb, total))
9897
r.status.Importance = widget.MediumImportance
9998
default:
10099
r.status.SetText(d.Status.ToStr())

0 commit comments

Comments
 (0)