| Summary: | External Tools / Run Shell Script : does not work | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | remi <remiforkdebugreport> |
| Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Flatpak | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/utilities/kate/-/commit/33ca1767dde9bec02e2f0fc49d6b617a855cfc42 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
Some additional questions : Is it reasonable to change the file permission (the 'chmod' part) by default ? What's the goal of 'pwd' in the command ? The default command has been introduced in this commit : https://invent.kde.org/utilities/kate/-/commit/0d1c47d198f6a3220fb10973635689416feab4e9 Reply to my previous comment : 'pwd' is useful, otherwise the konsole window does not show the path A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1330 Git commit 33ca1767dde9bec02e2f0fc49d6b617a855cfc42 by Christoph Cullmann, on behalf of Rémi Peuchot. Committed on 25/10/2023 at 21:52. Pushed by cullmann into branch 'master'. Fix run_shell_script default command arguments run_shell_script default command argument contains an invalid 'sh' command : read -n 1 Which returns the following error : -n: 1: read: arg count The 'sh' read command syntax seems to be : read my_variable letting the user to enter a value and press enter, so we can use $my_variable later. This fix consists of replacing the read command by a valid one : read null Which let the konsole window opened until the user press enter. M +1 -1 addons/externaltools/externaltools-config/run_shell_script https://invent.kde.org/utilities/kate/-/commit/33ca1767dde9bec02e2f0fc49d6b617a855cfc42 |
SUMMARY External Tools / Run Shell Script : does not execute the shell script Example script : #!/bin/bash echo hello echo hello > ~/hello STEPS TO REPRODUCE 1. Open a valid bash script : - begins with #!/bin/bash - owned by the current user - has +x file permission - executed successfully when launched from konsole 2. Click Menu > Tools > External Tools > Tools > Run Shell Script OBSERVED RESULT Konsole window opens and closes immediately The script is not executed EXPECTED RESULT The script is executed Konsole window shows the result Konsole window waits a key press to close the window SOFTWARE/OS VERSIONS Linux: Debian 11 KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION This bug is due to the default command arguments configured with "Run Shell Script" tool, which is : -e sh -c "cd %{Document:Path} && pwd && chmod -vc a+x %{Document:FileName} && ./%{Document:FileName} ; echo Press any key to continue. && read -n 1" When running the following command : sh -c read -n 1 We get an error : -n: 1: read: arg count On my system it can be solved by replacing : echo Press any key to continue. && read -n 1" by : echo Press enter to continue. && read null" Which is a valid sh command I can open a minimal merge request but I don't know the eventual implications on other systems