-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(runtime): make debugger be able to request the log from the even…
…t loop
- Loading branch information
1 parent
fbf648d
commit a777458
Showing
6 changed files
with
59 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
module Main where | ||
|
||
import System.Environment (getArgs) | ||
|
||
import qualified Scheduler | ||
|
||
------------------------------------------------------------------------ | ||
|
||
#ifdef __BAZEL_BUILD__ | ||
import GitHash | ||
-- When building with cabal we expect the git commit hash to be passed in via | ||
-- CPP flags, i.e. `--ghc-option=-D__GIT_HASH__=\"X\"`. | ||
#elif defined __GIT_HASH__ | ||
gitHash :: String | ||
gitHash = __GIT_HASH__ | ||
#else | ||
gitHash :: String | ||
gitHash = "unknown" | ||
#endif | ||
|
||
main :: IO () | ||
main = Scheduler.main | ||
main = do | ||
as <- System.Environment.getArgs | ||
if any (== "--version") as | ||
then putStrLn gitHash | ||
else Scheduler.main gitHash |
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 |
---|---|---|
@@ -1,4 +1,25 @@ | ||
module Debugger where | ||
|
||
import Control.Concurrent.Async | ||
import System.FilePath | ||
import System.IO | ||
import System.Posix.Files | ||
|
||
import StuntDouble | ||
|
||
------------------------------------------------------------------------ | ||
|
||
readLog :: IO Log | ||
readLog = do | ||
let pipe = "/tmp" </> "scheduler-admin" | ||
-- NOTE: We need to start reading the response before making the request to | ||
-- dump the log, otherwise the response will be written to the void. | ||
a <- async (withFile (pipe <> "-response") ReadWriteMode hGetLine) | ||
appendFile pipe "AdminDumpLog\n" | ||
s <- wait a | ||
return (read s) | ||
|
||
main :: IO () | ||
main = putStrLn "debugger" | ||
main = do | ||
l <- readLog | ||
print l |
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