Skip to content

Commit

Permalink
ignore empty command in Pipe extension #984
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Nov 16, 2024
1 parent 61a2d5c commit d3a1160
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugfix
* fix `terminal::login()` when user already authenticated [#980](https://github.com/jcubic/jquery.terminal/issues/980)
* improve mobile support
* ignore empty command in Pipe extension [#984](https://github.com/jcubic/jquery.terminal/issues/984)

## 2.44.1
### Bugfix
Expand Down
13 changes: 9 additions & 4 deletions js/pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@
}
// -------------------------------------------------------------------------------
function stringify(cmd) {
if (!cmd.name) {
return '';
}
return cmd.name + ' ' + cmd.args.map(function(arg, i) {
if (cmd.args_quotes[i]) {
var quote = cmd.args_quotes[i];
Expand Down Expand Up @@ -393,10 +396,12 @@
name: cmd.name,
completion: Object.keys(interpreter[cmd.name])
});
} else if (is_function(term_settings.onCommandNotFound)) {
term_settings.onCommandNotFound.call(term, command, term);
} else {
error(sprintf(strings(term).commandNotFound, cmd.name));
} else if (cmd.name) {
if (is_function(term_settings.onCommandNotFound)) {
term_settings.onCommandNotFound.call(term, command, term);
} else {
error(sprintf(strings(term).commandNotFound, cmd.name));
}
}
} else {
//term = term.duplicate();
Expand Down

0 comments on commit d3a1160

Please sign in to comment.