From 92da426ae808372e323e8550e5b8a1124970869a Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 25 Aug 2015 00:19:44 -0700 Subject: [PATCH] update --- main.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.cc b/main.cc index f1aa70f..b7445e6 100644 --- a/main.cc +++ b/main.cc @@ -461,13 +461,14 @@ int main(int argc, char **argv) { tpool.init(os.jobs); - os.cs.add_command("shell", "C", [](cscript::CsState &cs, char *s) { + os.cs.add_command("shell", "C", [](cscript::CsState &cs, + ostd::ConstCharRange s) { RuleCounter *cnt = counters.back(); cnt->incr(); - char *dup = strdup(s); - tpool.push([cnt, dup]() { - int ret = system(dup); - free(dup); + char *ds = ostd::String(s).disown(); + tpool.push([cnt, ds]() { + int ret = system(ds); + delete[] ds; if (ret && !cnt->result) cnt->result = ret; cnt->decr();