Skip to content

Commit 6f60d65

Browse files
committed
refactor: adjust the speed to real life
1 parent 40fa94a commit 6f60d65

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/shadowcopy/shadowcopy.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import (
55
"fmt"
66
"log"
77
"os/exec"
8+
"time"
89
)
910

1011
func Delete() error {
1112
log.Println("Executing command 'vssadmin delete shadows /for=norealvolume /all /quiet'")
1213
err := exec.Command("vssadmin", "delete", "shadows", "/for=norealvolume", "/all", "/quiet").Run()
14+
// it takes some time to delete the shadowcopies
15+
time.Sleep(5 * time.Second)
1316
var exitErr *exec.ExitError
1417
if errors.As(err, &exitErr) {
1518
if exitErr.ExitCode() != 2 {
@@ -19,4 +22,4 @@ func Delete() error {
1922
return fmt.Errorf("could not run command: %w", err)
2023
}
2124
return nil
22-
}
25+
}

lib/simulatemacro/macro.go

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os/exec"
99
"path/filepath"
1010
"strings"
11+
"time"
1112
)
1213

1314
func Run(args []string) error {
@@ -31,6 +32,8 @@ func Run(args []string) error {
3132
} else {
3233
os.Exit(0)
3334
}
35+
// it takes some time to startup Winword.exe
36+
time.Sleep(5 * time.Second)
3437
return nil
3538
}
3639

0 commit comments

Comments
 (0)