-
-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands not in sync when no system.describe in builtin RPC #475
Comments
Is you commands async or they are just echo something? if you use multiple execs use array: $.terminal.active().exec(['a', 'b', 'a', 'b']) if your commands are async (ajax or setTimeout etc.) you need to use Example:
this will also work if you call exec one by one: onInit: function() {
this.exec('command1');
this.exec('command2');
this.exec('command3');
}, NOTE: you can't call Instead of resume you can also return a promise from function, but it need to be resolved to undefined otherwise the value will be echoed to terminal, unless this is something you want. .terminal(function(cmd) {
if (cmd == 'x') {
return $.get('exec.html').then((data) => {
this.echo(data.split('\n')[0]); // no return so promise will resolve to undefined
});
} else {
this.pause();
setTimeout(() => this.echo(cmd).resume(), 500);
}
}, {
onInit: function() {
this.exec(['x', 'cmd1', 'cmd2']);
}
}); The promise is very flexible it only need to be object that have then function, so it work with native Promises or jQuery defereds. |
Hi,
|
Actually, Is there a way to run commands using |
This should work the same, do you the code somewhere online, where I can test this? |
Hi, I have emailed you the links. |
Not sure what the problem is. Maybe because you don't have system.describe method and different code is executed for rpc interpreter. Will investigate, this seems to be a bug. |
yes, the problem is |
Hi, Thanks! I did add |
Hm, the original option was not removed to not break existing code (that's why major version was not changed) will need to investigate |
Hi, 2 related questions:
Thank you. |
If you have system.describe, terminal know RPC methods and can create completion for you. So you can use |
Both errors should be fixed. |
Hi, If I bring up chrome's developer tools and If the developer tools is closed (implying |
Just to add, it seems very hard to replicate out-of-sync in a normal Chrome tab even with If I load the same link in a fancybox's iframe, out-of-sync happens more frequently. Any ideas? Thank you. |
Will check. I can also add option to exec only when terminal is visible, but this will be workaround, nevertheless it will be useful option. |
I cannot reproduce, can you provide a demo? the last url/user/passwd don't work: I was testing using this data uri:
|
no reply after almost 2 weeks, it should be fixed not possible to reproduce in iframe for new issue. |
Hi, Sorry, had other matters on hand. Will update this issue if I find a reliable method to reproduce it. Let's close this for now. Thank you. |
I have question related to jQuery Terminal
I used fire several
exec()
from insideonInit()
in v0.9.3, it worked correctly.My output was always:
Output A
On dev 2.2.1 using
exec()
, I'm gettingOutput B
I switch to using
execHash
and it worked correctly, i.e. output AMy question is, what is the recommended way to use
exec()
so that the output is correct, i.e. output A? Thank you.The text was updated successfully, but these errors were encountered: