Closed vlad2305m closed 1 year ago
currently executable running file depends on fine extension
event.cpp
/*
* shell scripts work, but I am not sure about other extensions
* neither start method form QProcess nor QProcess::startDetached
* don't work as expected
* need to find another way
*/
if (fileinfo.completeSuffix() == "sh" || firstLine.contains("bin/bash"))
return "/bin/sh";
In case of launching such a process you should also get able to get some logs:
if (success)
qInfo() << "Command: " << slot->getTextData() << " " << argumentsString
<< " executed successfully with pid: " << pid;
else
qWarning() << "Command " << slot->getTextData() << " " << argumentsString << " cannot be executed, pid: " << pid;
In current form code does not care about the shebang.
There is no way this is an enhancement...
You can either try reading first line and stripping the shebang and spaces to get path to the executable (an intended way of using shebangs)
Or you can add a GUI input field for the location of shell executable (kinda the way I do it now) that then does not display on the button text.
Alternatively, you can specify in Readme "/bin/sh
scripts" and then supporting other shells will be an enhancement.
Still does not work with /bin/fish
In my case, works as expected (tested with your example script).
Terminal test:
pawel@pop-os:/tmp/tmp$ fish ./fish.sh
./fish.sh (linia 2): $$ nie jest numerem identyfikacyjnym procesu. W fish używane jest $fish_pid.
echo $(ps -p $$)
^
warning: Wystąpił błąd podczas odczytywania pliku ./fish.sh
pawel@pop-os:/tmp/tmp$ bash ./fish.sh
PID TTY TIME CMD 14012 pts/1 00:00:00 bash
AntiMicroX test:
pawel@pop-os:~/antimicrox$ LABNG=en_US ./build/bin/antimicrox
/tmp/tmp/fish.sh (linia 2): $$ nie jest numerem identyfikacyjnym procesu. W fish używane jest $fish_pid.
echo $(ps -p $$)
^
warning: Wystąpił błąd podczas odczytywania pliku /tmp/tmp/fish.sh
Is there an existing issue for this?
Current Behavior
I wrote a script in fish only to discover that it is not working.
Output:
#!/bin/bash
also runs insh
instead.ps -p $fish_pid
=>error: list of process IDs must follow -p
bash shell runs the file in fish as expectedExpected Behavior
For shebang to be respected and script to run in fish.
Steps To Reproduce
antimicrox
in a terminalsh
and that any shell-specific syntax does not workEnvironment
Anything else?
Workaround: set executable to fish, argument to script (displays as
[Exec] fish
-> uninformative)