-
Notifications
You must be signed in to change notification settings - Fork 280
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
Exit on parse #169
base: master
Are you sure you want to change the base?
Exit on parse #169
Conversation
Not sure this is a good move - this is not always the desired behavior. I can name a few Vorpal apps in which the app doesn't exit after parsing. |
I see your point. See this stackoverflow that you answered:
The issue is that after my PR has been merged, there is a UI attached to the parse function. So Node will not exit naturally. Any recommended way to fix this problem? |
Okay... trying to find the best way to solve this. I think we need to add in options to
With this, the default behavior will be to exit, and if a flag is passed, the exit will be omitted. I don't really like |
👍 I like the idea of having options/config for parsing
|
Hahaha right? Just woke up, mind not functioning. @alansouzati would you be willing to add a |
You bet, great idea guys. Will add that tomorrow. Alan
|
Added the keepAlive, I believe we are good to go now 💃 |
lib/vorpal.js
Outdated
if (!options.keepAlive) { | ||
// Exits the CLI context as the UI is still attached | ||
this.exec('exit'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this block be placed outside of the if (err)
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this should definitely run outside of the error block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whops. not sure what happened here. shame on me 😲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha less shame, more tests.
Fixed wrong place for check
1ef3f9a
to
4359f43
Compare
fixed :) |
@alansouzati tried your branch with the mentioned fix from above but I still have one annoying issue, which is that the interactive shell prefix gets printed twice when I execute a command, e.g: ad help
local@macbookpro~$
Commands:
help [command...] Provides help for a given command.
exit Exits application.
...
local@macbookpro~$ where |
I think that's probably due to the fact that the ui attaches itself and then executes an exit command but I'd like your inputs on it before jumping into any conclusions... |
@alansouzati if we don't resolve this shortly, I'm going to have to revert that last PR. Willing to look into additional fixes for a little though. |
Yeah. I have the same issue. Well, I believe printing the current delimiter is less impactful than not supporting prompt for inline commands. See this issue for reference: |
I can try and investigate why the delimiter in being printed in this case, but I believe this is a separate issue from "exit on parse". |
👍 makes sense, @dthree IMHO it's preferable to merge this the way it is instead of reverting, a fix for the extra delimiters printed can wait more |
In the case of the delimiter, I believe if |
Okay. I would like to see if we could figure this delimiter thing out though... don't want to merge this and then have it forgotten about. |
Do you agree with this statement: "if keepAlive is false we should never print the delimiter." ? |
@dthree in a second thought, maybe a revert is really a good idea in this case seeing #172 it seems other people are suffering from the ui attach change as a breaking change adding the |
agreed with @ruyadorno. maybe we need a major release as it is a breaking change. But I believe we don't necessarily need to revert the change in Git to revert it in NPM. |
I'm pushing the fix for the delimiter here for you guys to evaluate. |
Ok, can you take a look now? If keepAlive is false no delimiter will be printed. |
@@ -157,7 +160,7 @@ session.delimiter = function (str) { | |||
if (str === undefined) { | |||
return this._delimiter; | |||
} | |||
this._delimiter = String(str).trim() + ' '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure why we are adding this empty space here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompt delimiter is a very touchy subject, and if you look in the issue history, there's a lot of subtle bug fixes involved with it. Be careful before changing things, as seeming fixes can break a lot of other things in this area.
I haven't been able to break out some code to test these things as I've been swamped, so sorry for not giving too much insight. Trying to do that as soon as possible, but I think for now we should just revert instead of piling fixes on fixes which break fixes which require more fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you bet. the PR is here anyways. let me know how I can help.
I did everything I could for now. I believe the ball is in your court now.
Let me know when you revert the changes so that I can re-open the issue with the ability to run prompts inside the parse context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that sometimes we need to add fixes that are not necessarily intuitive enough. I tend to add comments around it anytime I have to do things like that.
This way it helps future developers working on the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!! 👍
The git repo should always reflect NPM, for users' sake. |
@alansouzati just updated my project with the latest changes and I can confirm that this fixes the extra delimiters printed issue 👍 thank you so much for all the work on this 😊 |
thanks for trying it out @ruyadorno. It seems that we will need to wait until @dthree figures out the side effects of this change. |
@alansouzati I have yet another very tricky situation, I actually have a mixed of interactive and non-interactive ( in this situation it would be nice to have a way to define the keepAlive option from within the command definition instead... |
hey @dthree any updates on this? I have few folks complaining about the
|
Actually no rush anymore. I added my fork branch in my package.json for now. https://github.com/grommet/grommet-cli/blob/master/package.json#L27 |
This PR aims to exit (detach the UI) after parser execution is complete.