-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces compilation on Windows support
Extracts platform-dependent code to OpenTelemetry.Platform module
- Loading branch information
Showing
7 changed files
with
63 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module OpenTelemetry.Platform where | ||
|
||
import Control.Exception (throwIO, try) | ||
import qualified Data.Text as T | ||
import System.IO.Error (isDoesNotExistError) | ||
import System.Posix.User (getEffectiveUserName) | ||
|
||
|
||
tryGetUser :: IO (Maybe T.Text) | ||
tryGetUser = do | ||
eResult <- try getEffectiveUserName | ||
case eResult of | ||
Left err -> | ||
if isDoesNotExistError err | ||
then pure Nothing | ||
else throwIO err | ||
Right ok -> pure $ Just $ T.pack ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module OpenTelemetry.Platform where | ||
|
||
import qualified Data.Text as T | ||
|
||
|
||
tryGetUser :: IO (Maybe T.Text) | ||
tryGetUser = pure Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters