mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: Process examples (#8598)
This commit is contained in:

committed by
GitHub

parent
68b4051a6e
commit
2d875260e8
21
examples/process/execve.v
Normal file
21
examples/process/execve.v
Normal file
@@ -0,0 +1,21 @@
|
||||
module main
|
||||
|
||||
import os
|
||||
|
||||
fn exec(args []string) {
|
||||
mut out := ''
|
||||
mut line := ''
|
||||
mut line_err := ''
|
||||
|
||||
os.execve('/bin/bash', args, []) or {
|
||||
// eprintln(err)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// exec(["-c","find /"]) //works
|
||||
exec(['-c', 'find /tmp/']) // here it works as well
|
||||
|
||||
// exec(["-c","find","/tmp/"]) // does not work I guess is normal
|
||||
}
|
Reference in New Issue
Block a user