Hello Magic,
. [2019-01-11 20:44 +0100]:
> Thank you very much for the answer! Unfortunately I'm still stuck :-(
> Please take a look at the following code and tell me why it's still
> asynchronous. It display properly messages: "testFunct" and then "end of
> testFunct", but it never reach the .then or .done.
Seems you eventually figured it out on your own, but FTR:
> function testFunc() {
> alert("testFunc");
> lic = cockpit.spawn([
> "/usr/share/cockpit/testSoftware/connectExternalSystem"], {
> directory: "/usr/share/cockpit/testSoftware",
> err: "message"
> })
> .then(function() {
> alert("in .then of testFunc. Error: "+message);
> })
Note that this only gets called if connectExternalSystem succeeds -- *message*
is not defined here, so this can't work. What you want is
.then(output => alert("finished, output:", output))
.catch(error => alert("failed, error:", error);
> .done(function() {
> alert("in .done of testFunc. Error: "+message);
> });
And this makes no ssense at all -- alert doesn't return a promise, to calling
.done() on alert()'s result also doesn't work.
Martin
_______________________________________________
cockpit-devel mailing list -- cockpit-devel@lists.fedorahosted.org
To unsubscribe send an email to cockpit-devel-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/cockpit-devel@lists.fedorahosted.org