Branch: Tag:

2010-10-03

2010-10-03 23:10:58 by Martin Stjernholm <mast@lysator.liu.se>

Made it to work with 7.6.

To be a bit nicer to folks that have that old version in their paths, as
it's still the stock version coming with many dists.

53:      string run_git_ex(int max_exitcode, string ... args)   { -  mapping res = Process.run(({"git"})+args); -  if (res->exitcode > max_exitcode) { -  werror(res->stderr); -  fail("git exited with code %d\n", res->exitcode); +  Stdio.File mystdout = Stdio.File(); +  Stdio.File mystderr = Stdio.File(); +  Process.Process p = Process.Process (({"git"})+args, ([ +  "stdout":mystdout->pipe(), +  "stderr":mystderr->pipe(), +  ])); +  string gotstdout="", gotstderr=""; +  mystdout->set_read_callback( lambda( mixed i, string data) { +  gotstdout += data; +  } ); +  mystderr->set_read_callback( lambda( mixed i, string data) { +  gotstderr += data; +  } ); +  while( !p->status() || p->status() == 1 ) +  Pike.DefaultBackend( 1.0 ); +  +  mystdout->set_read_callback(0); +  mystderr->set_read_callback(0); +  +  gotstdout += mystdout->read(); +  gotstderr += mystderr->read(); +  +  int exitcode = p->wait(); +  +  if (exitcode > max_exitcode) { +  werror(gotstderr); +  fail("git exited with code %d\n", exitcode);    } -  return res->stdout; +  return gotstdout;   }      string run_git(string ... args)