|
8 | 8 |
|
9 | 9 | On Unix-like operating systems and Windows, Stack's installation procedure can
|
10 | 10 | be fully customised by placing a `sh` shell script (a 'hook') in the
|
11 |
| -[Stack root](..topics/stack_root.md) directory at `hooks/ghc-install.sh`. On |
| 11 | +[Stack root](../topics/stack_root.md) directory at `hooks/ghc-install.sh`. On |
12 | 12 | Unix-like operating systems, the script file must be made executable. The script
|
13 | 13 | is run by the `sh` application (which is provided by MSYS2 on Windows).
|
14 | 14 |
|
@@ -98,3 +98,36 @@ case $HOOK_GHC_TYPE in
|
98 | 98 | ;;
|
99 | 99 | esac
|
100 | 100 | ~~~
|
| 101 | + |
| 102 | +## `--file-watch` post-processing |
| 103 | + |
| 104 | +:octicons-tag-24: UNRELEASED |
| 105 | + |
| 106 | +On Unix-like operating systems and Windows, Stack's `build --file-watch` |
| 107 | +post-processing can be fully customised by specifying an executable or a `sh` |
| 108 | +shell script (a 'hook') using the |
| 109 | +[`file-watch-hook`](yaml/non-project.md#file-watch-hook) |
| 110 | +non-project specific configuration option. On Unix-like operating systems, the |
| 111 | +script file must be made executable. A script is run by the `sh` application |
| 112 | +(which is provided by MSYS2 on Windows). |
| 113 | + |
| 114 | +The following environment variables are always available to the executable or |
| 115 | +script: |
| 116 | + |
| 117 | +* `HOOK_FW_RESULT` (Equal to `""` if the build did not fail. Equal to the result |
| 118 | + of `displayException e`, if exception `e` thown during the build.) |
| 119 | + |
| 120 | +An example script is: |
| 121 | + |
| 122 | +~~~sh |
| 123 | +#!/bin/sh |
| 124 | + |
| 125 | +set -eu |
| 126 | + |
| 127 | +if [ -z "$HOOK_FW_RESULT" ]; then |
| 128 | + echo "Success! Waiting for next file change." |
| 129 | +else |
| 130 | + echo "Build failed with exception:" |
| 131 | + echo $HOOK_FW_RESULT |
| 132 | +fi |
| 133 | +~~~ |
0 commit comments