komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
komodo.doCommand('cmd_save')
//ko.run.runEncodedCommand(window, '%(python) \"C:\\\\PYTHON\\ftpDreamhost.py\" %F');
//komodo.view.displayPath
var scimoz = ko.views.manager.currentView.scimoz;
var linenum = scimoz.lineFromPosition(scimoz.currentPos) + 1;
var path = ko.views.manager.currentView.document.displayPath;
scimoz.insertText(0, cmd);
var filename = ko.views.manager.currentView.document.displayPath;
var cmd = 'python.exe -u \"C:\\\\PYTHON_SCRIPTS\\ftpDreamhost.py\" ' + filename;
StatusBar_AddMessage(cmd, "editor", 10000, true);
var runSvc = Components.classes["@activestate.com/koRunService;1"].
createInstance(Components.interfaces.koIRunService);
var process = runSvc.RunAndNotify(cmd /* command */,
"" /* cwd */,
"" /* environment settings */,
"" /* stdin input */);
//var retval = process.wait(-1); /* wait till the process is done */
var cancelled = false;
var retval = 999;
try {
retval = process.wait(3); // Give the command a little bit of time to run.
//dump("XXX RunAndNotify: child finished within 2s");
} catch (ex) {
// XXX Could getLastError here to determine if the wait failed
// because of WAIT_TIMEOUT or WAIT_FAILED. Should probably not
// ignore the latter, but punting on that for now.
//dump("XXX RunAndNotify: 2s passed, child has NOT finished");
obj = new Object();
obj.process = process;
obj.command = cmd;
ko.windowManager.openOrFocusDialog(
"chrome://komodo/content/run/waitfortermination.xul",
"komodo_waitfortermination",
"chrome,close=no,modal=yes,resizable=yes", obj);
if (obj.retval == "killed") { // Cancelled.
cancelled = true;
} else {
filename = ex
}
}
//scimoz.insertText(0, cmd);
if (!cancelled && process.getStderr() == "") {
StatusBar_AddMessage(filename + ": " + process.getStdout(), "editor", 10000, true);
} else {
StatusBar_AddMessage("ERROR: " + process.getStderr(), "editor", 10000, true);
}
//var process = runSvc.Run(cmd, '', '', '', true, '');