Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13_3] Use lolly 1.2.9 for system with result #1241

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Plugins/Bibtex/bibtex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ bibtex_run (string bib, string style, url bib_file, tree bib_t) {
debug_shell << cmdln << "\n";
}
string log;
if (system (cmdln, log))
if (lolly::system (cmdln, log))
bibtex_error << log << "\n";
else {
int pos=0;
Expand Down
4 changes: 2 additions & 2 deletions src/Plugins/Qt/qt_printer_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/

#include "sys_utils.hpp"
#include "qt_printer_widget.hpp"
#include "qt_utilities.hpp" // check_type<T>
#include "message.hpp" // slot definitions
#include "qt_sys_utils.hpp" // qt_system(string)
#include "QTMPrintDialog.hpp"
#include "QTMPrinterSettings.hpp"

Expand Down Expand Up @@ -92,7 +92,7 @@ qt_printer_widget_rep::showDialog () {
// Send the document to the printer
if (DEBUG_QT_WIDGETS)
debug_widgets << "Running print command: " << from_qstring(_cmd) << "\n";
qt_system(from_qstring(_cmd)); // FIXME? qt_system is synchronous (blocking!)
lolly::system(from_qstring(_cmd)); // FIXME? qt_system is synchronous (blocking!)

// execute the scheme closure
if (!is_nil (commandAfterExecution))
Expand Down
60 changes: 0 additions & 60 deletions src/Plugins/Qt/qt_sys_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,63 +27,3 @@ string qt_get_current_cpu_arch () {
string qt_get_pretty_os_name () {
return from_qstring (QSysInfo::prettyProductName ());
}

#if !defined (OS_WASM)
static void
ReadOutputs(QProcess& p, string& o, string& e) {
if (p.processChannelMode() == QProcess::MergedChannels)
o = p.readAll ().constData ();
else {
o = p.readAllStandardOutput ().constData ();
e = p.readAllStandardError ().constData ();
}
if (DEBUG_STD) debug_shell << o << e;
}

static int
qt_system (QProcess& proc, string& cmd, string& cmdout, string& cmderr) {
c_string _cmd (cmd);
#if defined(OS_MINGW) || defined(OS_WIN)
QString qcmd = QString::fromUtf8 ((char*)_cmd);
#else
QString qcmd = "sh -c \"";
qcmd += _cmd;
qcmd += "\"";
#endif

proc.start (qcmd);
if (! proc.waitForStarted ()) {
if (DEBUG_STD) debug_shell << "System: failed to launch command\n";
return 1;
}
proc.closeWriteChannel ();
if (! proc.waitForFinished ()) { //default time 30000ms
if (DEBUG_STD) debug_shell << "System: waiting for too long\n";
ReadOutputs (proc, cmdout, cmderr);
proc.close ();
return 2;
}
ReadOutputs (proc, cmdout, cmderr);
return proc.exitCode ();
}

int
qt_system (string cmd) {
string result;
return qt_system (cmd, result);
}

int
qt_system (string cmd, string& cmdout, string& cmderr) {
QProcess proc;
return qt_system (proc, cmd, cmdout, cmderr);
}

int
qt_system (string cmd, string& result) {
QProcess proc;
string dummy;
proc.setProcessChannelMode (QProcess::MergedChannels);
return qt_system (proc, cmd, result, dummy);
}
#endif // !defined (OS_WASM)
20 changes: 1 addition & 19 deletions src/System/Misc/tm_sys_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,10 @@ string get_pretty_os_name () {
* System functions
******************************************************************************/

int
system (string s, string& result, string& error) {
#if defined(OS_MINGW) || defined(OS_WIN)
return -1;
#else
return qt_system (s, result, error);
#endif
}

int
system (string s, string& result) {
#ifdef OS_WASM
return -1;
#else
return qt_system (s, result);
#endif
}

string
eval_system (string s) {
string result;
(void) system (s, result);
(void) lolly::system (s, result);
return result;
}

Expand Down
3 changes: 0 additions & 3 deletions src/System/Misc/tm_sys_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ string get_stacktrace (unsigned int max_frames= 127);
string get_current_cpu_arch ();
string get_pretty_os_name ();

int system (string s, string &r);
int system (string s, string &r, string& e);

string eval_system (string s);
string var_eval_system (string s);

Expand Down
4 changes: 2 additions & 2 deletions xmake/packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-- [ ] portage powered
-- ...

local LOLLY_VERSION = "1.2.8"
local LOLLY_VERSION = "1.2.9"
local TBOX_VERSION = "1.7.4"

-- https://xmake.io/#/manual/package_dependencies?id=inherit-package-configuration
Expand All @@ -35,7 +35,7 @@ package("lolly")
add_deps("libcurl")
end

add_versions("v" .. LOLLY_VERSION, "2bb0aa7d9534d5155770baecc66e06b01ed18068")
add_versions("v" .. LOLLY_VERSION, "c4173095d8a1afdeef37cdb48ee6453d3e5960eb")

on_install("linux", "macosx", "mingw", "wasm", "windows", function (package)
local configs = {}
Expand Down