mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 19:25:25 +03:00
http://reasonml.github.io/ Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
--- a/src/rtop/rtop.sh
|
|
+++ b/src/rtop/rtop.sh
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/env bash
|
|
+#!/bin/sh
|
|
# Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
|
|
|
|
|
@@ -13,15 +13,26 @@
|
|
# require's reason, so that reason is required after .ocamlinit is
|
|
# parsed in standard syntax.
|
|
|
|
-touch $HOME/.utoprc
|
|
-touch $HOME/.utop-history
|
|
-DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
+# Enable pipefail if supported.
|
|
+if ( set -o pipefail 2>/dev/null ); then
|
|
+ set -o pipefail
|
|
+fi
|
|
|
|
+touch "$HOME"/.utoprc
|
|
+touch "$HOME"/.utop-history
|
|
+
|
|
# intercept the -stdin flag of utop, and preprocess the code into reason code
|
|
# before forwarding it. Afaik currently there's no better way of intercepting
|
|
# the code after urtop receives code from stdin and before it processes it
|
|
-if [[ $@ =~ "stdin" ]]; then
|
|
- refmt --parse re --print ml --interface false | utop-full $@
|
|
+stdin=no
|
|
+for arg in "$@"; do
|
|
+ case "$arg" in
|
|
+ -stdin) stdin=yes; break;;
|
|
+ esac
|
|
+done
|
|
+
|
|
+if [ "$stdin" = yes ]; then
|
|
+ refmt --parse re --print ml --interface false | utop-full "$@"
|
|
else
|
|
- utop-full -init $DIR/rtop_init.ml $@ -I $HOME -safe-string
|
|
+ utop-full -init /usr/share/reason-rtop/rtop_init.ml "$@" -I "$HOME" -safe-string
|
|
fi
|