87e9262001-06-22Martin Nilsson // This file is part of Roxen Search
6351652009-05-25Martin Stjernholm // Copyright © 2001 - 2009, Roxen IS. All rights reserved.
87e9262001-06-22Martin Nilsson //
7d979f2010-10-26Martin Stjernholm // $Id$
87e9262001-06-22Martin Nilsson 
e1d7152000-11-24Johan Schön //! The MIME content types this class can filter.
df57a22001-01-02Johan Schön constant contenttypes = ({ });
e1d7152000-11-24Johan Schön 
28d6b82001-08-08Martin Nilsson //!
40a44d2004-08-07Johan Schön .Output filter(Standards.URI uri, string|Stdio.File data,
e262e52001-06-05Per Hedbor  string content_type, mixed ... more);
32e8b52001-06-28Johan Schön 
47fcc42003-03-19Jonas Wallden string my_popen(array(string) args, string|void cwd, int|void wait_for_exit)
94b6102001-08-08Fredrik Noring  // A smarter version of Process.popen: No need to quote arguments. { Stdio.File pipe0 = Stdio.File(); Stdio.File pipe1 = pipe0->pipe(Stdio.PROP_IPC); if(!pipe1) if(!pipe1) error("my_popen failed (couldn't create pipe).\n");
8b420e2005-05-23Anders Johansson  mapping setup = ([ "env":getenv(), "stdout":pipe1, "nice": 20 ]);
b225322003-01-20Jonas Wallden  if (cwd) setup["cwd"] = cwd;
47fcc42003-03-19Jonas Wallden  Process.create_process proc = Process.create_process(args, setup);
94b6102001-08-08Fredrik Noring  pipe1->close(); string result = pipe0->read(); if(!result) error("my_popen failed with error "+pipe0->errno()+".\n"); pipe0->close();
47fcc42003-03-19Jonas Wallden  if (wait_for_exit) proc->wait();
94b6102001-08-08Fredrik Noring  return result;
32e8b52001-06-28Johan Schön }