Skip to content

Commit

Permalink
clean and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
hassandraga committed Jun 9, 2022
2 parents fcb1f9a + d746a73 commit 3f5f308
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion include/webui/webui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define WEBUI_H

// -- C++ Standard -----------------------------
#include <array> //
#include <iostream> //
#include <string> //
#include <vector> //
Expand Down Expand Up @@ -281,4 +282,4 @@ namespace webui{
};
}

#endif
#endif
25 changes: 12 additions & 13 deletions src/webui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,10 +1385,8 @@ namespace webui{

//boost::process::environment env = ::boost::this_process::environment();
//boost::process::child c(cmd, browser::env, boost::process::windows::hide);
boost::process::child c(cmd);

c.wait();
return c.exit_code();
return boost::process::system(cmd);

}

int command_browser(std::string cmd){
Expand Down Expand Up @@ -1626,7 +1624,7 @@ namespace webui{
#ifdef _WIN32
return WinUserProfile;
#elif __APPLE__
char* tmpdir = std::getenv("TMPDIR");
char* tmpdir = std::getenv("TMPDIR");
return tmpdir;
#else
return "/var/tmp";
Expand Down Expand Up @@ -1678,9 +1676,9 @@ namespace webui{
if(!folder_exist(temp + webui::sep + profile_name)){

#ifdef _WIN32
browser::command("cmd /c \"" + browser::browser_path + " -CreateProfile \"WebUI " + temp + webui::sep + profile_name + "\" > nul 2>&1");
browser::command(std::string("cmd /c \"") + browser::browser_path + " -CreateProfile \"WebUI " + temp + webui::sep + profile_name + "\" > nul 2>&1");
#else
browser::command("sh -c \"" + browser::browser_path + " -CreateProfile \"WebUI " + temp + webui::sep + profile_name + "\" >>/dev/null 2>>/dev/null\"");
browser::command(std::string("") + browser::browser_path + " -CreateProfile " + "\"WebUI "+ temp + webui::sep + profile_name + "\""); // we can't do escaping to redirect error .. todo
#endif
std::string buf;

Expand Down Expand Up @@ -1776,9 +1774,9 @@ namespace webui{
full.append(address);

#ifdef _WIN32
if(browser::command_browser("cmd /c \"" + full + "\" > nul 2>&1") == 0)
if(browser::command_browser(std::string("cmd /c \"") + full + "\" > nul 2>&1") == 0)
#else
if(browser::command_browser("sh -c \"" + full + " >>/dev/null 2>>/dev/null\"") == 0)
if(browser::command_browser( full + " >>/dev/null 2>>/dev/null") == 0)
#endif
{
browser::CurrentBrowser = firefox;
Expand Down Expand Up @@ -1815,10 +1813,11 @@ namespace webui{
std::string full(p_custom->app);
full.append(arg);


#ifdef _WIN32
if(browser::command_browser("cmd /c \"" + full + "\" > nul 2>&1") == 0)
if(browser::command_browser(std::string("cmd /c \"") + full + "\" > nul 2>&1") == 0)
#else
if(browser::command_browser("sh -c \"" + full + " >>/dev/null 2>>/dev/null\"") == 0)
if(browser::command_browser(full + " >>/dev/null 2>>/dev/null") == 0)
#endif
{
browser::CurrentBrowser = custom;
Expand Down Expand Up @@ -1847,9 +1846,9 @@ namespace webui{
full.append(address);

#ifdef _WIN32
if(browser::command_browser("cmd /c \"" + full + "\" > nul 2>&1") == 0)
if(browser::command_browser(std::string("cmd /c \"") + full + "\" > nul 2>&1") == 0)
#else
if(browser::command_browser("sh -c \"" + full + " >>/dev/null 2>>/dev/null\"") == 0)
if(browser::command_browser( full + " >>/dev/null 2>>/dev/null") == 0)
#endif
{
browser::CurrentBrowser = chrome;
Expand Down

1 comment on commit 3f5f308

@hassandraga
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is by https://github.com/usama-makhzoum, I just removed an extra commit that I added today by accident.

Please sign in to comment.