Skip to content

Commit

Permalink
os: flush stdout and stderr before calling _wsystem (on windows), as …
Browse files Browse the repository at this point in the history
…the MSDN doc advices (#20034)
  • Loading branch information
smalltalkman committed Nov 29, 2023
1 parent 74c59ab commit dc3ea0f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vlib/os/os.c.v
Expand Up @@ -400,6 +400,8 @@ pub fn system(cmd string) int {
// overcome bug in system & _wsystem (cmd) when first char is quote `"`
wcmd := if cmd.len > 1 && cmd[0] == `"` && cmd[1] != `"` { '"${cmd}"' } else { cmd }
unsafe {
C.fflush(C.stdout)
C.fflush(C.stderr)
ret = C._wsystem(wcmd.to_wide())
}
} $else {
Expand Down

0 comments on commit dc3ea0f

Please sign in to comment.