diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba1606f..5bd81653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/js/pipe.js b/js/pipe.js index e6f42933..e731ca46 100644 --- a/js/pipe.js +++ b/js/pipe.js @@ -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]; @@ -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();