Skip to content

Commit da8c9ce

Browse files
committed
Re #5925 Re-establish documentation
1 parent f745da0 commit da8c9ce

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

doc/configure/customisation_scripts.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
On Unix-like operating systems and Windows, Stack's installation procedure can
1010
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
1212
Unix-like operating systems, the script file must be made executable. The script
1313
is run by the `sh` application (which is provided by MSYS2 on Windows).
1414

@@ -98,3 +98,36 @@ case $HOOK_GHC_TYPE in
9898
;;
9999
esac
100100
~~~
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

Comments
 (0)