Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.93k stars 397 forks source link

First run of "draft init" on Windows causes containing console window to close #747

Closed mlgibbons closed 6 years ago

mlgibbons commented 6 years ago

If I run "draft init" in a CMD console it closes the console on completion. This does not happen if run in a PowerShell console.

bacongobbler commented 6 years ago

This behaviour unfortunately is the default behaviour of CMD and PowerShell. When a command exits with a non-zero exit code, the terminal abruptly exits. See http://blog.danskingdom.com/keep-powershell-console-window-open-after-script-finishes-running/

I've had better behaviour with VSCode's integrated terminal, Hyper or Cmder as the terminal of choice. :)

mlgibbons commented 6 years ago

Hi bacongobbler. It appears that I was incorrect in my earlier understanding and the behaviour is the same in Cmd and PowerShell. I've amended to title to reflect this. It appears that it is state dependant i.e. if I wipe $HOME\.draft and run "draft init" the terminal exits after the "Installing default plugins ..." message. The $HOME\.draft is there and appears to be fully populated though. If I then run "draft init" again the rest of the msgs are displayed and a "Happy sailing" appears. Diffing the $HOME\.draft tree before and after the second "draft init" run shows only a single difference i.e. the write time on the .draft\cache\plugins directory. Run a "draft create|up" etc after the first run (which looked like it failed) and everything works fine. Weird. So I guess that the question is, "why does 'draft init' exit with a non-zero RC on the first run through even though the $HOME.draft folder appears to be complete and draft is functional?"

bacongobbler commented 6 years ago

Without any logs I can't tell ya :) if you purge %userhome%\.draft and re-run draft init what do you see?

mlgibbons commented 6 years ago

By "see" you mean in the logs dir? It's empty. Even when using --debug; although that did spit more info out to console. Piped it to file (figuring maybe stdout was not being fully flushed to console before it closed) and saw this where p1 is the first init output and pi is the second.

C:\temp>type p Installing default plugins... Downloading https://azuredraft.blob.core.windows.net/draft/pack-repo-v0.4.2-windows-amd64.zip Preparing to install into C:\Users\Mark.draft\plugins\draft-pack-repo\bin pack-repo installed into C:\Users\Mark.draft\plugins\draft-pack-repo\bin\pack-repo.exe Installed plugin: pack-repo Installation of default plugins complete Installing default pack repositories... Installing pack repo from https://github.com/Azure/draft

C:\temp>type pi Installing default plugins... Installation of default plugins complete Installing default pack repositories... Installation of default pack repositories complete $DRAFT_HOME has been configured at C:\Users\Mark.draft. Happy Sailing!

radu-matei commented 6 years ago

I think this is addressed by #717 Could you please let us know if the problem still exists after that fix?

Thanks!

bacongobbler commented 6 years ago

Ah yes, this definitely looks like #717. Nice catch!

@mlgibbons if you want to verify that this is fixed in the canaries, the links to the canary releases can be found here: https://github.com/Azure/draft/blob/master/docs/install-minikube.md#install-draft :smile:

radu-matei commented 6 years ago

I just tested again on Windows and this indeed seems to be fixed. Closing this, but feel free to reopen, @mlgibbons, if you encounter any other issues related to init on Windows!

Thanks!

mlgibbons commented 6 years ago

Radu. Excellent. Will do. Many thanks. Mark.

On 31 May 2018 04:21:17 GMT-04:00, Radu Matei notifications@github.com wrote:

I just tested again on Windows and this indeed seems to be fixed. Closing this, but feel free to reopen, @mlgibbons, if you encounter any other issues related to init on Windows!

Thanks!

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Azure/draft/issues/747#issuecomment-393452165