08-20-2016, 03:08 AM
Hi,
Recently passed from Windows to Ubuntu 16.04, and I'm not able to correctly use "Command Runner" plugin anymore.
After lots of searches, it seems to me that the plugin is not Linux & Mac compliant due to the way of working of "Runtime exec" java class/method in Unix systems.
The source file of azexec (last version 1.3.2) has a function "public void onCompletion(Download d)" which run the command this way :
the plugin log contains the good full command thanks to this :
and no error return through this :
But for both shell command run functions :
and
it's not working as expected.
I don't know why for the first implementation (don't know how it's executed after) but for the second way, I'm quite sure it can't work in unix as soon as there are special caracters in (and there's generally quotes in %D or other torrent path/name/... or double quotes needed by user) because of unix/java way of interpreting command with exec()...
To reproduce the issue, just try to run something like that in command run, on UNIX :
Someone more advanced than me in java could probably easyly fix this issue in plugin and update azexec plugin ?
Thanks a lot for your answers & advices.
Regards,
Rudy
Recently passed from Windows to Ubuntu 16.04, and I'm not able to correctly use "Command Runner" plugin anymore.
After lots of searches, it seems to me that the plugin is not Linux & Mac compliant due to the way of working of "Runtime exec" java class/method in Unix systems.
The source file of azexec (last version 1.3.2) has a function "public void onCompletion(Download d)" which run the command this way :
Code:
final String command_to_run = command;
plugin_interface.getUtilities().createThread(d.getName() + " exec", new Runnable() {
public void run() {
channel.log("Executing: " + command_to_run);
boolean use_runtime_exec = use_runtime_exec_param.getValue();
try {
if (use_runtime_exec) {
Runtime.getRuntime().exec(command_to_run);
}
else {
plugin_interface.getUtilities().createProcess(command_to_run);
}
}
catch (Throwable t) {
channel.logAlert("Unable to run \"" + command_to_run + "\".", t);
}
}
});
Code:
channel.log("Executing: " + command_to_run);
Code:
catch (Throwable t) {
channel.logAlert("Unable to run \"" + command_to_run + "\".", t)
Code:
plugin_interface.getUtilities().createProcess(command_to_run);
Code:
Runtime.getRuntime().exec(command_to_run);
I don't know why for the first implementation (don't know how it's executed after) but for the second way, I'm quite sure it can't work in unix as soon as there are special caracters in (and there's generally quotes in %D or other torrent path/name/... or double quotes needed by user) because of unix/java way of interpreting command with exec()...
To reproduce the issue, just try to run something like that in command run, on UNIX :
Code:
ls -ltr > "/tmp/result.log"
Someone more advanced than me in java could probably easyly fix this issue in plugin and update azexec plugin ?
Thanks a lot for your answers & advices.
Regards,
Rudy