aboutsummaryrefslogtreecommitdiff
path: root/bwrap-files
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-06-14 19:12:53 +0200
committerTom Smeding <tom@tomsmeding.com>2022-06-14 19:12:53 +0200
commitaa6327c3f630c9b7b7ceef8d07f3a57ca03cccf1 (patch)
treeac54f3f5d17e6c69b3d2ec894547bc767a269a0d /bwrap-files
parent181bdd640a5a605ed43cc14b295a6536541e428e (diff)
Early-catch large show output with -interactive-print
Diffstat (limited to 'bwrap-files')
-rwxr-xr-xbwrap-files/start.sh6
-rw-r--r--bwrap-files/workdir/Yahb2Defs.hs8
-rwxr-xr-xbwrap-files/workdir/entry.sh (renamed from bwrap-files/entry.sh)2
3 files changed, 12 insertions, 4 deletions
diff --git a/bwrap-files/start.sh b/bwrap-files/start.sh
index 03bf77e..f0d0fa1 100755
--- a/bwrap-files/start.sh
+++ b/bwrap-files/start.sh
@@ -20,6 +20,7 @@ args=(
--ro-bind "${ghcup_base}/bin" "${ghcup_base}/bin"
--ro-bind "${ghcup_base}/ghc" "${ghcup_base}/ghc"
--ro-bind "${ghcup_base}/cache" "${ghcup_base}/cache"
+ --ro-bind "${filesdir}/workdir" /workdir
--setenv PATH "/bin:/usr/bin:${ghcup_base}/bin"
--setenv GHCUP_INSTALL_BASE_PREFIX "$(dirname ${ghcup_base})"
--proc /proc
@@ -27,8 +28,7 @@ args=(
--new-session
--unshare-all
--die-with-parent
- --file 4 "/tmp/entry.sh"
- /bin/bash "/tmp/entry.sh"
+ /bin/bash "/workdir/entry.sh"
)
# Turn off core files
@@ -40,4 +40,4 @@ ulimit -u 10000
# Limit memory to 500 MiB.
ulimit -d $(( 500 * 1024 ))
-exec bwrap "${args[@]}" 4<"${filesdir}/entry.sh"
+exec bwrap "${args[@]}"
diff --git a/bwrap-files/workdir/Yahb2Defs.hs b/bwrap-files/workdir/Yahb2Defs.hs
new file mode 100644
index 0000000..c0dfbfd
--- /dev/null
+++ b/bwrap-files/workdir/Yahb2Defs.hs
@@ -0,0 +1,8 @@
+module Yahb2Defs where
+
+
+limitedPrint :: Show a => a -> IO ()
+limitedPrint x =
+ case splitAt 200 (show x) of
+ (s, "") -> putStrLn s
+ (s, _) -> putStrLn (take 197 s ++ "...")
diff --git a/bwrap-files/entry.sh b/bwrap-files/workdir/entry.sh
index f9c4ad3..1a466da 100755
--- a/bwrap-files/entry.sh
+++ b/bwrap-files/workdir/entry.sh
@@ -3,4 +3,4 @@ set -euo pipefail
cd "$(dirname "$0")"
-ghcup --offline run -- ghci 2>&1
+ghcup --offline run -- ghci Yahb2Defs.hs 2>&1