daml/bazel_tools/client_server/tests/client.sh
Gary Verhaegen d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00

39 lines
809 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -eu
foobar=0
port=""
inputFile=""
while [ "$#" -gt 0 ]; do
case "$1" in
--target-port) port="$2"; shift 2;;
--target-port=*) port="${1#*=}"; shift 1;;
--foobar) foobar=1; shift 1;;
-*) echo "unknown option: $1" >&2; exit 1;;
*) inputFile="$1"; shift 1;;
esac
done
if [ "$foobar" -ne 1 ]; then
echo "--foobar not passed in"
exit 1
fi
if [[ -z "$port" || -z "$inputFile" ]]; then
echo "target port or input file not specified"
exit 1
fi
exec 5<> /dev/tcp/localhost/$port
cat $inputFile >&5
cat <&5
# Write the output file for testing client_server_build.
if [ -n "${CS_OUT-}" ]; then
echo "hello" > $CS_OUT
fi