SerGreen / Appacker

Tool for making single .exe application packages
235 stars 29 forks source link

CLI Exit Issue #2

Closed Janca closed 6 years ago

Janca commented 6 years ago

The application does not exit properly. You must press Enter in the command prompt after the application should have exited to actually get the application to exit. This is happens whether an error occurs, when packing is successful or even just displaying the help message.

This is causing in issue in my workflow as I am waiting for exit signals. Although this isn't the place, thanks for your work and commitment to this project.

SerGreen commented 6 years ago

If i understood correctly, you're talking about a situation when there's no C:\> input invitation in the console after running Appacker in command line: https://i.imgur.com/aXO5QDp.png. In fact, it does exit properly and you can type a new command even without pressing Enter: https://imgur.com/a/7ETwOrk.
It happens because Appacker runs as a separate process, so console launches Appacker and immediately prints C:\>, but then Appacker attaches to the console and prints there its own output. So the console is actually in 'input-awaiting' state after the exit of Appacker, but C:\> is left behind. https://i.imgur.com/J89mBlg.png

But while it works as it is right now, i totally agree that it's ugly and non-intuitive, and i want to make it prettier. I have two crutches for this on my mind:

  1. I can add a new line with > symbol so it will look something like this: https://i.imgur.com/Wf59gC4.png
    Simple and not so pretty, but slightly better than now.
  2. I can try to send an {Enter} key press message to the parent console. However, this will bring the console to the foreground every time appacker exits, this might or might not become the problem for your workflow.

IMO the second one is preferable. I've tried a quick solution and it turned out to be slow though (a few seconds delay before it presses Enter), but i'll try to optimize it after i get some sleep.
Let me know if you would prefer a different solution.

Janca commented 6 years ago

My mistake. It does exit. As it is only a visual issue I wouldn't spend too much time on it, but if you were to consider an option I think it would be best to display the current working path if possible to emulate the console. IE: C\Users\hunter2\workflow1> vs just the single >

SerGreen commented 6 years ago

Yeah, it's possible to get the working directory and print it, you're right.
Solution with sending {Enter} to the command prompt turned out to be not consistent and unreliable (did not trigger every time) due to WinAPI shenanigans.
This solution with the simulation of working directory + > is simple and actually works perfectly.
All is done and i'm pushing the update now (+ another little improvement).

SerGreen commented 6 years ago

God dammit, i closed #1 in the commit message instead of #2... Ok Google, how to change commit message easily? .___. Anyways, update with the fix should be up. Cheers!