cmd.add("-c");
cmd.add(script);
for (int i = 0; i < args.length(); i++) {
cmd.add(args.getString(i));
}
Command command = new Command(cmd, true);
command.start();
int exitCode = command.waitFor(60 * 1000);
JSONObject jo = new JSONObject();
jo.put("exitCode", exitCode);
jo.put("stdout", toOutput(command.getStdOut()));
jo.put("stderr", toOutput(command.getErr()));
Response resp = new Response();
resp.setSessionId(getSession().getSessionId());
resp.setStatus(0);
resp.setValue(jo);