1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: implement os.system for iOS and uncomment the $if ios blocks (#5947)

This commit is contained in:
pancake
2020-07-24 09:17:32 +02:00
committed by GitHub
parent 921b5cddd0
commit 04ef2a2671
5 changed files with 19 additions and 12 deletions

View File

@ -453,22 +453,22 @@ pub fn system(cmd string) int {
ret = C._wsystem(wcmd.to_wide())
}
} $else {
/*
// make
// make selfcompile
// ./v -os ios hello.v
$if ios {
// TODO: use dlsym, use posix_spawn or embed ios_system
eprintln('system not supported on ios')
ret = 1
unsafe {
arg := [ c'/bin/sh', c'-c', byteptr(cmd.str), 0 ]
pid := 0
ret = C.posix_spawn(&pid, '/bin/sh', 0, 0, arg.data, 0)
status := 0
ret = C.waitpid(pid, &status, 0)
if C.WIFEXITED(status) {
ret = C.WEXITSTATUS(status)
}
}
} $else {
*/
unsafe {
ret = C.system(charptr(cmd.str))
}
/*
}
*/
}
if ret == -1 {
print_c_errno()