Back to index

qt_sys_utils.cpp File Reference
#include "qt_sys_utils.hpp"
#include "basic.hpp"
#include "string.hpp"
#include <QProcess>
#include <QString>

Go to the source code of this file.


int qt_system (string cmd)
int qt_system (string cmd, string &result)

Function Documentation

int qt_system ( string  cmd)

Definition at line 20 of file qt_sys_utils.cpp.

  string result;
  return qt_system (cmd, result);

Here is the call graph for this function:

Here is the caller graph for this function:

int qt_system ( string  cmd,
string result 

Definition at line 26 of file qt_sys_utils.cpp.

  QProcess proc;

  proc.setProcessChannelMode (QProcess::MergedChannels);
  char* _cmd = as_charp (cmd);
#if defined (__MINGW__) || defined (__MINGW32__)
  QString qcmd = QString::fromLocal8Bit (as_charp (_cmd));
  QString qcmd = "sh -c \"";
  qcmd += _cmd;
  qcmd += "\"";
  tm_delete_array (_cmd);
  proc.start (qcmd);
  if (! proc.waitForStarted ()) {
    if (DEBUG_STD) cerr << "TeXmacs] System: failed to launch command\n";
    return 1;
  proc.closeWriteChannel ();
  if (! proc.waitForFinished (-1)) {
    if (DEBUG_STD) cerr << "TeXmacs] System: waiting for too long\n";
    return 1;
  result = proc.readAll ().constData ();
  if (DEBUG_STD) cerr << result;
  return proc.exitCode ();

Here is the call graph for this function: