Run exception handlers on SIGTERM in daml assistant (#2069)

This commit is contained in:
Moritz Kiefer 2019-07-09 15:44:09 +02:00 committed by GitHub
parent 13253d82d1
commit 75ea177e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 8 deletions

View File

@ -83,7 +83,7 @@
- DA.Sdk.Cli.System
- DA.Sdk.Cli.Version
- DAML.Assistant.Install.Path
- DamlHelper.Signals
- DA.Signals
- Development.IDE.Core.Compile
- Development.IDE.GHC.Compat
- {name: ImplicitParams, within: []}

View File

@ -3,7 +3,6 @@
load("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_test")
load("//bazel_tools/packaging:packaging.bzl", "package_app")
load("@os_info//:os_info.bzl", "is_windows")
da_haskell_library(
name = "daml-helper-lib",
@ -29,7 +28,7 @@ da_haskell_library(
"safe-exceptions",
"text",
"yaml",
] + ([] if is_windows else ["unix"]),
],
visibility = ["//visibility:public"],
deps = [
"//daml-assistant:daml-project-config",

View File

@ -9,8 +9,8 @@ import System.Environment
import System.Exit
import System.IO
import DA.Signals
import DamlHelper.Run
import DamlHelper.Signals
main :: IO ()
main =

View File

@ -7,6 +7,7 @@ module DAML.Assistant
( main
) where
import DA.Signals
import DAML.Project.Config
import DAML.Assistant.Types
import DAML.Assistant.Env
@ -30,6 +31,7 @@ import Safe
-- | Run the assistant and exit.
main :: IO ()
main = displayErrors $ do
installSignalHandlers
builtinCommandM <- tryBuiltinCommand
case builtinCommandM of
Just builtinCommand -> do

View File

@ -88,7 +88,7 @@ fi
cat > $DAML_HOME/bin/daml-head << EOF
#!/bin/bash
DAML_SDK_VERSION=0.0.0 $DAML_HEAD_SDK/daml/daml "\$@"
exec env DAML_SDK_VERSION=0.0.0 $DAML_HEAD_SDK/daml/daml "\$@"
EOF
chmod +x $DAML_HOME/bin/daml-head

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_test")
load("@os_info//:os_info.bzl", "is_windows")
da_haskell_library(
name = "da-hs-base",
@ -50,7 +51,7 @@ da_haskell_library(
"utf8-string",
"uuid",
"vector",
],
] + ([] if is_windows else ["unix"]),
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [

View File

@ -4,7 +4,7 @@
{-# LANGUAGE CPP #-}
-- | Module that turns SIGTERM into a UserInterrupt exception in Unix.
module DamlHelper.Signals
module DA.Signals
( installSignalHandlers
) where
@ -25,4 +25,3 @@ installSignalHandlers = do
mainThread <- myThreadId
void $ installHandler sigTERM (Catch $ throwTo mainThread UserInterrupt) Nothing
#endif

View File

@ -11,3 +11,5 @@ HEAD — ongoing
- [daml assistant] Fix VSCode path for use if not already in PATH on mac
- [DAML-LF] Fixed regression that produced an invalid daml-lf-archive artefact. See `#2058 <https://github.com/digital-asset/daml/issues/2058>`__.
- [daml assistant] Kill child processes on ``SIGTERM``. This means that killing
``daml sandbox`` will also kill the sandbox process.