Skip to content
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

Fix Microsoft Windows crashes #313

Merged
merged 7 commits into from
Jun 22, 2017
Merged

Fix Microsoft Windows crashes #313

merged 7 commits into from
Jun 22, 2017

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Jun 14, 2017

Fixes #311

Steps to test

TODO

  • Print message about windows support in installer when on windows
  • Mention windows support in diagnose output?
  • Installer (prompt to customize app name) and Diagnose (prompt to send report to AppSignal) "hang" the CLI. No content has been flushed to STDOUT on Windows (need to do that manually) so it appears to hang when we ask for user input on Windows.

@tombruijn tombruijn force-pushed the windows branch 2 times, most recently from 5937dc9 to b2206f4 Compare June 16, 2017 10:23
This is not to fix Microsoft Windows support entirely, but just to allow
users to install AppSignal without errors on the OS. This does not
guarantee AppSignal working in its entirety on Microsoft's OS.

This change uses a different method to find the tmp dir for Windows
while keeping the original logic for *NIX and macOS. Because the logic
is a bit more dynamic now for the system's tmp dir I moved it to a
method that's stubbed for most specs, except the ones that test the
actual implementation of the method.
When the extension is not loaded running the diagnose task will error
out when parsing the agent report when requested from the extension.
This change checks beforehand if the extension is loaded or not.
Print done notice even when we don't detect the framework. Then also
send a demo sample. Hopefully the red "Warning" will attract people's
attention that even thought the installation has been completed we still
can't detect the framework.

Printing the done notice also prints the warning when a user is
installing AppSignal on Windows.
Don't save the username on Microsoft Windows, but also don't error the
program. The `Etc.getpwuid(uid)` returns `nil` on Windows.
Write output immediately to STDOUT on Microsoft Windows.
Without `$stdout.sync = true` the output would be saved until the end of
the program and then flushed to STDOUT.

When we print the output immediately we don't get the illusion of a
hanging installer and diagnose task when we ask for user input. Because
the user input prompt hasn't been flushed to STDOUT the user doesn't see
what's expected of them to do. This change fixes that.
`getch` throws a `Errno::EBADF: Bad file descriptor` error on Microsoft
Windows. I am unable to fix that. Using `getc` creates the same behavior
and also works on Microsoft Windows.

This fixes the "Press any key" prompts on Microsoft's OS, fixing the
installer prompts.
Copy link
Member

@thijsc thijsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@thijsc thijsc merged commit d0c520c into master Jun 22, 2017
@thijsc thijsc deleted the windows branch June 22, 2017 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants