Commit graph

10 commits

Author SHA1 Message Date
Michael Niksa fbd50af8af
Change exit code to hex; Fix format spec (#11123)
Process exit code now shows as hex not decimal. Format specification needs length "10" not "8" because the leading '0x' generated by the # symbol counts as part of the length.

## PR Checklist
* [x] Closes annoyance at looking up process exit codes
* [x] I work here.
* [x] Checked manually

## Validation Steps Performed
- [x] Ran it, opened tab, opened another CMD tab, ran `exit <code>` and observed hex pattern
2021-09-21 15:47:17 +00:00
Mike Griese bfc4838042
Disable path validation, add warning (#10045)
This is primarily being done to unblock #9223.

Prior to this, we'd validate that the user's `startingDirectory` existed
here. If it was invalid, we'd gracefully fall back to `%USERPROFILE%`.

However, that could cause hangs when combined with WSL. When the WSL
filesystem is slow to respond, we'll end up waiting indefinitely for
their filesystem driver to respond. This can result in the whole terminal
becoming unresponsive.

Similarly, with #9223 we want users to be able to specify WSL paths in a
profile, but this bit of validation logic totally prevents that from working,
because it'll just replace the path with `%USERPROFILE%`.

If the path is eventually invalid, we'll display warning in the
`ConptyConnection`, when the process fails to launch.

Closes #9541
Closes #9114

![image](https://user-images.githubusercontent.com/18356694/117318675-426d2d00-ae50-11eb-9cc0-0b23c397472c.png)
2021-05-12 17:36:11 +00:00
Dustin L. Howett d33ca7e8eb
From orbit, nuke the Telnet connection and all supporting infra. (#7840)
This is not going to be our plan of record for Universal going forward.

This updates the Universal configuration to 1) match non-universal and 2) switch to local applications
2020-10-09 18:59:58 +00:00
Dustin L. Howett (MSFT) c186c7d683
Rework error handling and state flow in the Azure connection (#5356)
This commit fixes a number of problems and code quality/health issues
with the AzureConnection.

This is a general tidying-up of the azure connection. It improves error
logging (like: it actually emits error logs...) and retry logic and the
state machine and it audits the exit points of the state machine for
exceptions and removes the HRESULT returns (so they either succeed and
transition to a new state or throw an exception or are going down
anyway).

There's also a change in here that changes how we display tenants. It
adds the "default domain" to the name, so that instead of seeing this:

Conhost (aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa)
Default Directory (bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb)

you see this

Conhost (conhost.onmicrosoft.com)
Default Directory (dustinhowett.onmicrosoft.com)

Changes:

* rework tenant/tenant storage and fix display names

  Switch to the 2020 tenant API.

  Instead of passing around four loose variables, create a Tenant class
  and use that for packing/unpacking into/out of json (and the windows
  credential store, where we "cleverly" used json for the tenant info
  there too).
  
  When displaying a tenant, use its display name if there is one, the
  unknown resource string if there isn't, and the default domain if
  there is one and the ID if there isn't.
  
  Fixes #5325.

* use {fmt} for formatting request bodies
* remove dead strings
* rework/rename Request/HeaderHelper to
  Send(Authenticated)ReqReturningJson
* rewrite polling to use std::chrono
* remove HR returns from state machine
* rename state handlers from _XHelper to _RunXState
* cleanup namespaces, prefix user input with >, remove namespaces
* Rework error handling
  - _RequestHelper no longer eats exceptions.
  - Delete the "no internet" error message.
  - Wrap exceptions coming out of Azure API in a well-known type.
  - Catch by type.
  - Extract error codes for known failures (keep polling, invalid
    grant).
  - When we get an Invalid Grant, dispose of the cached refresh token
    and force the user to log in again.
  - Catch all printable exceptions and print them.
  - Remove the NoConnect state completely -- just bail out when an
    exception hits the toplevel of the output thread.
  - Move 3x logic into _RefreshTokens and pop exceptions out of it.
  - Begin abstracting into AzureClient

Fixes #5325 (by addressing its chief complaint).
Fixes #4803 (by triggering auth flow again if the token expires).
Improves diagnosability for #4575.
2020-04-16 17:32:52 -07:00
Dustin L. Howett (MSFT) 37e62dabd5
Fix localizability issues in Windows Terminal (#5339)
Loc issues are given to us through the internal bug tracker.

* Lock some strings, or parts of strings, that should not be localized.
* Switch to positional format parameters
* Remove the forced newlines in the warning resources; insert them at
  runtime

Fixes MSFT:25936156.
2020-04-14 20:48:46 +00:00
Dustin L. Howett (MSFT) 0be070f340
Prepare for automated localization (#5119)
This pull request includes a localization config file that identifies
the modules we need to localize. It also moves us back to the
`Resources\LANGUAGE\Resources.resw` resource layout, but using wildcards
so that the build system can pick up any number of languages.
2020-03-25 21:06:59 +00:00
Dustin L. Howett (MSFT) 693cdc1c95
Unify resource filenames across the repository (#4642)
This unifies the rest of the projects around the resource structure laid out in WindowsTerminalUniversal. Now we'll have a single flat structure for resource files and keep the qualifiers in their filenames. It's easier to manage this way.
2020-02-20 23:51:41 +00:00
Michael Niksa 402b7ff0e0
Create Telnet connection type and default loopback profile for… (#3858)
For our Universal terminal for development purposes, we will use telnet to escape the universal application container and empower developers to debug/diagnose issues with their own machine on loopback to the already-elevated telnet context.
2019-12-09 11:07:08 -08:00
Dustin L. Howett (MSFT) 901a1e1a09
Implement ConnectionState and closeOnExit=graceful/always/never (#3623)
This pull request implements the new
`ITerminalConnection::ConnectionState` interface (enum, event) and
connects it through TerminalControl to Pane, Tab and App as specified in
#2039. It does so to implement `closeOnExit` = `graceful` in addition to
the other two normal CoE types.

It also:

* exposes the singleton `CascadiaSettings` through a function that
  looks it up by using the current Xaml application's `AppLogic`.
  * In so doing, we've broken up the weird runaround where App tells
    TerminalSettings to CloseOnExit and then later another part of App
    _asks TerminalControl_ to tell it what TerminalSettings said App
    told it earlier. `:crazy_eyes:`
* wires up a bunch of connection state points to `AzureConnection`.
  This required moving the Azure connection's state machine to use another
  enum name (oops).
* ships a helper class for managing connection state transitions.
* contains a bunch of template magic.
* introduces `WINRT_CALLBACK`, a oneshot callback like `TYPED_EVENT`.
* replaces a bunch of disparate `_connecting` and `_closing` members
  with just one uberstate.
* updates the JSON schema and defaults to prefer closeOnExit: graceful
* updates all relevant documentation

Specified in #2039
Fixes #2563

Co-authored-by: mcpiroman <38111589+mcpiroman@users.noreply.github.com>
2019-11-25 14:22:29 -08:00
Dustin L. Howett (MSFT) d26865f460
Move AzureConnection's strings into localizable resources (#3463)
This also sets up TerminalConnection to _have_ resources, which will be useful for the messages in #3461.
2019-11-07 12:26:45 -08:00