mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: add an .exit_code field to os.Command (#13321)
* Added os.Command.exit_code * vfmt vlib/os/os_test.v * extract os.Command to os.v, add a dummy panicing implementation on windows, just for parity, fix os_test.v on macos, skip test_command on windows. Co-authored-by: Merlin Diavova <md@merlindiaova.org> Co-authored-by: Delyan Angelov <delian66@gmail.com>
This commit is contained in:
@@ -364,16 +364,6 @@ pub fn execute(cmd string) Result {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Command {
|
||||
mut:
|
||||
f voidptr
|
||||
pub mut:
|
||||
eof bool
|
||||
pub:
|
||||
path string
|
||||
redirect_stdout bool
|
||||
}
|
||||
|
||||
[manualfree]
|
||||
pub fn (mut c Command) start() ? {
|
||||
pcmd := c.path + ' 2>&1'
|
||||
@@ -412,9 +402,9 @@ pub fn (mut c Command) read_line() string {
|
||||
return final
|
||||
}
|
||||
|
||||
pub fn (c &Command) close() ? {
|
||||
exit_code := vpclose(c.f)
|
||||
if exit_code == 127 {
|
||||
pub fn (mut c Command) close() ? {
|
||||
c.exit_code = vpclose(c.f)
|
||||
if c.exit_code == 127 {
|
||||
return error_with_code('error', 127)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user