I found many ways to work remotely in Komodo, using scp publishing and macros to send commands, I think is possible to compile c using commands remotely, sadly I can not figure it how to do it yet.
Actually I am uploading my C files using komodo SCP server tool (a remote project file, not using publishing tool).
These are the commands I need to run on the remote server to compile and run the program (it’s a linux server):
gcc my_program.c -o my_program
./my_program
There is any way to send these commands and get the answer on the Komodo Console?
Hi, you could try creating a new toolbox command (Tools > Run Command… and then check “Add to Toolbox”) that executes your compile command remotely on a server. I’m not exactly sure what the syntax would be, but I’m pretty sure ssh allows this. Any output should be printed in Komodo’s output window.
Thank you mitchell, I can not figure it yet, to run a remote command I need to give komodo an user, password and address to connect, Where can I write these parameters?
Komodo does not resolve the remote IP, it just runs ssh which is doing the magic. You can define ~/.ssh/config file with something like that:
Host hostname
HostName your_ip
Port 22
User root
And then access it by ssh hostname (in case you’re using a ssh key).
I’m not sure there’s a way to send a password using an argument for ssh command so the only way to do that is generate a ssh key and send it to the server so they key will be trusted.
the script run on the remote (the bits in single-quotes after the host) is just a plain ol’ shell script. I don’t want to put the actual script here (I guess it’s technically company proprietary ) but you can imagine it saying something like:
It piggybacks on the current files remote connection so you’ll have to have a file open from the remote server which I assume you do.
If that work flow doesn’t work for you we can figure out a way that you could pick a server configuration from you preferences and use that to maintain the connection to pass commands across.
Usefull! I didn’t know you can declare functions globally, I got some logs in console using this:
var w = document.getElementById('console-widget').contentWindow;
w.document.getElementById('output').innerHTML = ''; // clear console (thanks to nathanr)
if(stderr.value!="") console.error(stderr.value); // prints errors if any
else console.log(stdout.value); // else prints output
Anything declared without var is automatically made global. Note, this is terrible practice and you should never do it in your code and that Userscript should be re-written to NOT do it but I have to get to work on 10.1 features otherwise I would fix it .
Unless that variable was previous declared locally of course. Javascript gotchas ftw!
Note that this is why it is usually better to be explicit with your global variables by declaring it on the window object, ie. window.var = 'foo' instead of var = foo.