wxExecute invoking window in Windows, not so in Linux

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

wxExecute invoking window in Windows, not so in Linux

Post by p_lu »

Hi,

From Windows (10), when I invoke wxExecute from a (Codeblocks) wxFrame app,
specifying a shell program (in this case Cygwin Bash), the framework opens a
shell window and executes the script within it. In (Debian/Raspian) Linux, however,
the framework processes the shell program within the window that invoked the
app. This probably has to do with the "local environment" behavior.

Is there a way I can get wxExecute to open a shell window in the Linux environment,
in the same way that Windows(10) does it? In particular, I would probably define
the SH (as below for the __linux__ case) to invoke something else that invokes /bin/sh
in turn?

Thanks for all help in advance.


=== For instance, this is the code I have...

#ifdef __linux__
#define SH "/bin/sh -c \'"
#else // Windows
#define SH "c:\\cygwin64\\bin\\sh -c \'"
#endif

...

string some_command = "/path_to_script";
string cmd = SH + some_command + "\'";
wxExecute(cmd);
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxExecute invoking window in Windows, not so in Linux

Post by p_lu »

I think one option might be xterm (or Terminal). Any better or more fitting
method, more parallel to the Windows case?

Thanks.
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxExecute invoking window in Windows, not so in Linux

Post by p_lu »

Looks like

#define SH "/usr/bin/lxterm -geometry 100x30 -e /bin/sh -c \'"

works fine.

Thanks.
Post Reply