Пример #1
0
bool TestExtProcess::test_system() {
  g_context->obStart();
  Variant ret;
  String last_line = f_system("echo hello; echo world;", ref(ret));
  String output = g_context->obCopyContents();
  g_context->obEnd();

  VS(output, "hello\nworld\n");
  VS(last_line, "world");
  VS(ret, 0);

  string cur_cwd = Process::GetCurrentDirectory();
  f_chdir("/tmp/");
  VS(f_system("/bin/pwd"), "/tmp");
  f_chdir(String(cur_cwd));
  return Count(true);
}
Пример #2
0
bool TestExtProcess::test_system() {
  g_context->obStart();
  Variant ret;
  String last_line = f_system("echo hello; echo world;", ref(ret));
  String output = g_context->obGetContents();
  g_context->obEnd();

  VS(output, "hello\nworld\n");
  VS(last_line, "world");
  VS(ret, 0);
  return Count(true);
}