fix dup MAX
parent
acb00bf623
commit
ac66d49c51
14
os/os.v
14
os/os.v
|
@ -293,19 +293,11 @@ pub fn system(cmd string) string {
|
||||||
if isnil(f) {
|
if isnil(f) {
|
||||||
println('popen $cmd failed')
|
println('popen $cmd failed')
|
||||||
}
|
}
|
||||||
#define MAX 1000
|
max := 1000
|
||||||
# char buf[MAX];
|
# char buf[max];
|
||||||
// # char* buf = malloc(MAX);
|
# while (fgets(buf, max, f) != NULL) {
|
||||||
// j# sleep(1);
|
|
||||||
// # if (!fgets(buf, MAX, f)) {
|
|
||||||
// jprintln('first get failed')
|
|
||||||
// jos.print_c_errno()
|
|
||||||
// j# }
|
|
||||||
# while (fgets(buf, MAX, f) != NULL) {
|
|
||||||
// # printf("popen buf=%s\n", buf);
|
|
||||||
# res = string_add(res, tos(buf, strlen(buf)));
|
# res = string_add(res, tos(buf, strlen(buf)));
|
||||||
# }
|
# }
|
||||||
// println(res)
|
|
||||||
return res.trim_space()
|
return res.trim_space()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue