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

cannot run file in terminal --- Neon3 and Ubuntu 16.04 #141

Closed
dm1seven opened this issue Apr 18, 2017 · 13 comments
Closed

cannot run file in terminal --- Neon3 and Ubuntu 16.04 #141

dm1seven opened this issue Apr 18, 2017 · 13 comments

Comments

@dm1seven
Copy link

The menu item Run with Gnome Terminal does not show anything. I think the command line for this item is not correct. I tried the command line bellow: it works if I directly call it in gnome terminal with the actual file names, but still does not work from EasyShell in Eclipse.

gnome-terminal --working-directory=${easyshell:container_loc} -e "bash -c ./${easyshell:resource_name}; bash"

Source of the custom command:
http://stackoverflow.com/questions/38135995/how-to-open-a-gnome-terminal-to-execute-a-command-with-gnome-terminal-constantl

@anb0s anb0s self-assigned this Apr 18, 2017
@anb0s anb0s added this to the v2.1 milestone Apr 18, 2017
@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

Thanks for reporting. I see two possible problems and solutions:

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

If it still not working, please enable the debug output:
image
and send me the output after executing the command...

@MariusDrulea
Copy link

MariusDrulea commented Apr 18, 2017

I have tested the 2.1 build. I have the same behavior as before. Bellow I have attached the debug messages.
I have tried to directly call the "run" command from the terminal like that:
gnome-terminal --working-directory=/home/marius/work/workspace/cpp11/Debug --command=./'cpp11'
This command does not work. There is nothing wrong with the plugin itself, it's just about the gnome-terminal command above.

image

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

Thanks. The log looks good for me. Please check if this helps:

  • verify if gnome-terminal has a bug described in issue gnome-terminal: change to working directory does not work in LMDE 201403 #6: enable this checkbox in the command:
    image
    it will set working dir before starting gnome-terminal, so this can be removed from command: "--working-directory=${easyshell:container_loc}"
  • remove single quotes from command:
    gnome-terminal --working-directory=${easyshell:container_loc} --command=./"${easyshell:resource_name}"
    I've already done it, but will verify it again today at home with my Debian 9.0 system...

@MariusDrulea
Copy link

MariusDrulea commented Apr 18, 2017

I have found the command actually got executed, but nothing is displayed because the terminal closes quickly after the bash script is executed.

I have added: int n; cin >> n; into the code, to wait for the user command and the terminal appeared after that.

@MariusDrulea
Copy link

MariusDrulea commented Apr 18, 2017

In order to keep the terminal open without cin >> n, I have used the following command pattern:
gnome-terminal --working-directory=${easyshell:container_loc} -e "bash -c ./'${easyshell:resource_name}';bash".

I have found this option at this link
The terminal stays alive with this command.

However, I don't fully like it because when I close the terminal I get the following warning, see the picture.
image

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

Here are the parameters: http://manpages.ubuntu.com/manpages/xenial/man1/gnome-terminal.1.html
I've tried some variants and see no other solution now, like you described:
gnome-terminal --working-directory=${easyshell:container_loc} -e "bash -c ./'${easyshell:resource_name}';bash"
Thanks!

Alternatives:
I've had always problems with using gnome-terminal and use xfce-terminal or sakura that have --hold parameter for this or KDE konsole --noclose:
xfce4-terminal --working-directory=${easyshell:container_loc} --command=./"'${easyshell:resource_name}'" --hold

sakura --execute=./"'${easyshell:resource_name}'" --hold

konsole --workdir ${easyshell:container_loc} --noclose -e ${easyshell:resource_loc}

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

With Debian 9.0 i cannot execute with the original gnome-command, only with -e "bash -c..." it works!
@MariusDrulea: does the original command from EasyShell works for you with int n; cin >> n; at Ubuntu ?

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

Another possibility to hold the gnome-terminal is to call a script with or similar:

#!/bin/sh
'$1'
read -p "Press space to continue..." var_name

I've already some commands that uses this way...

@MariusDrulea
Copy link

int n; cin >> n; works in Ubuntu with the original gnome-terminal command, see it bellow. The terminal waits for the user to enter the number.
gnome-terminal --working-directory=${easyshell:container_loc} --command=./"'${easyshell:resource_name}'"

@MariusDrulea
Copy link

I have finally found a solution. The command bellow works as expected. The trick was to add exec bash at the end, not just bash.
👍
gnome-terminal --working-directory=${easyshell:container_loc} -e "bash -c ./'${easyshell:resource_name}';'exec bash'"

The explanation is bellow and at the following link: http://stackoverflow.com/questions/3512055/avoid-gnome-terminal-close-after-script-execution

exec causes the running process to be replaced by the new process, otherwise you will have two bash processes running

Since there is a single bash process running in the terminal, the "Close this terminal?" warning no longer appears.

@anb0s
Copy link
Owner

anb0s commented Apr 18, 2017

Cool :) i will add this command as "Run Gnome Terminal (noclose or hold)" for next release too. Thanks!

@anb0s
Copy link
Owner

anb0s commented Apr 20, 2017

will be done with #144

@anb0s anb0s closed this as completed Apr 20, 2017
anb0s added a commit that referenced this issue Apr 21, 2017
new fixed issues in this build:
- [x] #28 Show EasyShell entry on maven dependencies
- [x] #84 add support for multipage editor
- [x] #136 [v2.0] possibility to change menu icons
- [x] #137 add DoubleCommander support
- [x] #138 add GNOME Commander support
- [x] #139 add Sunflower file browser support
- [x] #140 add Midnight Commander support
- [x] #141 cannot run file in terminal --- Neon3 and Ubuntu 16.04
- [x] #142 exception in 'Variables Test'
- [x] #143 adapt sakura terminal emulator command
- [x] #144 rework all 'Run' commands
- [x] #145 add Msys2 / MinGW32 / MinGW64 bash preset
- [x] #146 add EasyShell branding information

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue Apr 21, 2017
new fixed issues in this build:
- [x] #28 Show EasyShell entry on maven dependencies
- [x] #84 add support for multipage editor
- [x] #136 [v2.0] possibility to change menu icons
- [x] #137 add DoubleCommander support
- [x] #138 add GNOME Commander support
- [x] #139 add Sunflower file browser support
- [x] #140 add Midnight Commander support
- [x] #141 cannot run file in terminal --- Neon3 and Ubuntu 16.04
- [x] #142 exception in 'Variables Test'
- [x] #143 adapt sakura terminal emulator command
- [x] #144 rework all 'Run' commands
- [x] #145 add Msys2 / MinGW32 / MinGW64 bash preset
- [x] #146 add EasyShell branding information

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue May 9, 2017
- [x] #150 [v2.1] testing of build 2.1.0.v20170508-1844
  - [x] #101 add Run command for Mac OS X
  - [x] #148 add Q-Dir (Quad Explorer) preset
  - [x] #149 "Unhandled event loop exception" with 36 menu items and
quick menu
- [x] #147 [v2.1] testing of build 2.1.0.v20170421-1258
  - [x] #28 Show EasyShell entry on maven dependencies
  - [x] #84 add support for multipage editor
  - [x] #136 [v2.0] possibility to change menu icons
  - [x] #137 add DoubleCommander support
  - [x] #138 add GNOME Commander support
  - [x] #139 add Sunflower file browser support
  - [x] #140 add Midnight Commander support
  - [x] #141 cannot run file in terminal --- Neon3 and Ubuntu 16.04
  - [x] #142 exception in 'Variables Test'
  - [x] #143 adapt sakura terminal emulator command
  - [x] #144 rework all 'Run' commands
  - [x] #145 add Msys2 / MinGW32 / MinGW64 bash preset
  - [x] #146 add EasyShell branding information
- [x] #135 [v2.1] testing of build 2.1.0.v20161220-2025
  - [x] #127 NPE at
de.anbos.eclipse.easyshell.plugin.commands.DefineCommands.createContributionItems(DefineCommands.java:46)
  - [x] #134 [v2.1] [menu dialog] command and name are editable but
should be read-only
- [x] #133 [v2.1] testing of build 2.1.0.v20161218-1511
  - [x] #130 [v2.1] menu dialog looks weird
  - [x] #131 [v2.1] [command dialog] "split command" has no effect for
"clipboard" type
  - [x] #132 [v2.1] fix quotes and "split command" in windows presets
- [x] #129 [v2.1] testing of build 2.1.0.v20161214-2215
  - [x] #123 [v2.1] guake preset does not work with 2.1.0.v20161210-2045
  - [x] #124 [v2.0] run presets with single quotes are not working
  - [x] #125 add Enlightenment (Terminology emulator)
  - [x] #126 [v2.0] add search or filter for faster selection of
commands in menu dialog
  - [x] #128 [v2.1] add exceptions for internal errors
- [x] #122 [v2.1] testing of build 2.1.0.v20161210-2045
  - [x] #105 [v2.1] add option for showing tooltips
  - [x] #115 add option for debug output in console
  - [x] #118 [build 2.1.0.v20161203-1029] crash if using new "Split
spaces only" option
  - [x] #119 [v2.0] add variables for parent container
  - [x] #120 [build 2.1.0.v20161203-1029] presets modifications are
removed after each second edit
  - [x] #121 [v2.0] add TotalCommander presets for left and right
windows
- [x] #117 testing of build 2.1.0.v20161203-1029
  - [x] #112 add linux guake support
  - [x] #113 add linux krusader support
  - [x] #116 [v2.0] plugin presets are stored together with user
modifications --> migration of presets not possible
- [x] #111 [v2.1] testing of build 2.1.0.v20161103-2010
  - [x] #18 check compatibility to other terminal emulators
  - [x] #102 Menu contains each item twice on Mac OS (by default)
  - [x] #106 [v2.0] keyboard shortcuts are not working in popup menu
under Linux
  - [x] #107 [v2.0] add support for external files
  - [x] #108 add mate-terminal support
  - [x] #109 add mate Caja (MATE) file browser support
  - [x] #110 LXDE: add lxterminal support
- [x] #104 [v2.1] testing of build 2.1.0.v20161102-1515
  - [x] #76 [v2.0] Steps to build the plugin using the source code
  - [x] #98 add support for PowerCmd
  - [x] #99 add support iTerm2 in Mac
  - [x] #100 add open with Default application for Mac OS X
  - [x] #103 After copied file path, a tool-tip "Copied to clipboard"
always exists.

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue May 9, 2017
- [x] #150 [v2.1] testing of build 2.1.0.v20170508-1844
  - [x] #101 add Run command for Mac OS X
  - [x] #148 add Q-Dir (Quad Explorer) preset
  - [x] #149 "Unhandled event loop exception" with 36 menu items and
quick menu
- [x] #147 [v2.1] testing of build 2.1.0.v20170421-1258
  - [x] #28 Show EasyShell entry on maven dependencies
  - [x] #84 add support for multipage editor
  - [x] #136 [v2.0] possibility to change menu icons
  - [x] #137 add DoubleCommander support
  - [x] #138 add GNOME Commander support
  - [x] #139 add Sunflower file browser support
  - [x] #140 add Midnight Commander support
  - [x] #141 cannot run file in terminal --- Neon3 and Ubuntu 16.04
  - [x] #142 exception in 'Variables Test'
  - [x] #143 adapt sakura terminal emulator command
  - [x] #144 rework all 'Run' commands
  - [x] #145 add Msys2 / MinGW32 / MinGW64 bash preset
  - [x] #146 add EasyShell branding information
- [x] #135 [v2.1] testing of build 2.1.0.v20161220-2025
  - [x] #127 NPE at
de.anbos.eclipse.easyshell.plugin.commands.DefineCommands.createContributionItems(DefineCommands.java:46)
  - [x] #134 [v2.1] [menu dialog] command and name are editable but
should be read-only
- [x] #133 [v2.1] testing of build 2.1.0.v20161218-1511
  - [x] #130 [v2.1] menu dialog looks weird
  - [x] #131 [v2.1] [command dialog] "split command" has no effect for
"clipboard" type
  - [x] #132 [v2.1] fix quotes and "split command" in windows presets
- [x] #129 [v2.1] testing of build 2.1.0.v20161214-2215
  - [x] #123 [v2.1] guake preset does not work with 2.1.0.v20161210-2045
  - [x] #124 [v2.0] run presets with single quotes are not working
  - [x] #125 add Enlightenment (Terminology emulator)
  - [x] #126 [v2.0] add search or filter for faster selection of
commands in menu dialog
  - [x] #128 [v2.1] add exceptions for internal errors
- [x] #122 [v2.1] testing of build 2.1.0.v20161210-2045
  - [x] #105 [v2.1] add option for showing tooltips
  - [x] #115 add option for debug output in console
  - [x] #118 [build 2.1.0.v20161203-1029] crash if using new "Split
spaces only" option
  - [x] #119 [v2.0] add variables for parent container
  - [x] #120 [build 2.1.0.v20161203-1029] presets modifications are
removed after each second edit
  - [x] #121 [v2.0] add TotalCommander presets for left and right
windows
- [x] #117 testing of build 2.1.0.v20161203-1029
  - [x] #112 add linux guake support
  - [x] #113 add linux krusader support
  - [x] #116 [v2.0] plugin presets are stored together with user
modifications --> migration of presets not possible
- [x] #111 [v2.1] testing of build 2.1.0.v20161103-2010
  - [x] #18 check compatibility to other terminal emulators
  - [x] #102 Menu contains each item twice on Mac OS (by default)
  - [x] #106 [v2.0] keyboard shortcuts are not working in popup menu
under Linux
  - [x] #107 [v2.0] add support for external files
  - [x] #108 add mate-terminal support
  - [x] #109 add mate Caja (MATE) file browser support
  - [x] #110 LXDE: add lxterminal support
- [x] #104 [v2.1] testing of build 2.1.0.v20161102-1515
  - [x] #76 [v2.0] Steps to build the plugin using the source code
  - [x] #98 add support for PowerCmd
  - [x] #99 add support iTerm2 in Mac
  - [x] #100 add open with Default application for Mac OS X
  - [x] #103 After copied file path, a tool-tip "Copied to clipboard"
always exists.

Signed-off-by: Andre Bossert <anb0s@anbos.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants