Okay I'm really stumped because this was just working, but cockpit.spawn
seems to be misbehaving
Here is my js:
function get_insts() {
var insts = ["None"];
cockpit.spawn(['ls', '/tmp'], { superuser: true }).done(function(data)
{
insts= ["okay we actually got here"];
}).fail(function(error){
insts = ["FAIL"];
});
// Set html paragragh to insts
...
}
$(window.document).ready(function() {
get_insts();
$("body").show();
});
"insts" is always set to "None". Debugging shows odd behavior. When
I
refresh the page cockpit.spawn just doesn't do anything.
cockpit.js
1832 function(e ,n) <= n is the correct list of arguments
But it does not execute function, then it skips to
1842 u.close = function(e) {
It does not execute function, then it skips to
1847 returns u
We don't fail, and we don't succeed, and my js function completes.
Then... my js function get_insts() gets called again automatically (not
sure how its getting called twice from the page reload), and it does
appear to succeed the second time, data has expected values, but somehow
after we get the data the debugger stops in a cockpit function listed
below. It loops a few times in the cockpit function, then my js
function, get_insts(), just aborts and disappears silently even though
things seemed to working correctly on the second pass.
cockpit-ws-151-2.fc26
cockpit.js:867
function P(e) {
var n, t, r;
r = e.pending;
e.process_scheduled = false;
e.pending = undefined;
for (var o = 0, a = r.length; o < a; ++o) {
e.pur = true;
t = r[o][0];
n = r[o][e.status];
if (i(n)) {
t.resolve(n.apply(e.promise, e.values)); <--
debugger stops here, then its loops and moves on
} else if (e.status === 1) {
t.resolve.apply(t.resolve, e.values);
} else {
t.reject.apply(t.reject, e.values);
}
}
}
I don't know what to do next, this is very odd behavior. Especially
since it worked earlier today. I even rebooted my laptop :-( I tried
different and simple commands to send to cockpit.spawn, but it doesn't
change this behavior.
Anything else I should be looking at?
Thanks,
Mark
Show replies by thread