Skip to content

Commit 1e1c12c

Browse files
author
Graham Krizek
committed
Use own temp files instead of mktemp
1 parent 841ee03 commit 1e1c12c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bootstrap

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ sendRuntimeError () {
2828
# Send successful response to Lambda API
2929
sendResponse () {
3030
REQUEST_ID=$1
31-
RESPONSE=$2
32-
curl -sS -X POST -d "$RESPONSE" "http://${AWS_LAMBDA_RUNTIME_API}/${RUNTIME_PATH}/invocation/${REQUEST_ID}/response" > /dev/null
31+
REQUEST_RESPONSE=$2
32+
curl -sS -X POST -d "$REQUEST_RESPONSE" "http://${AWS_LAMBDA_RUNTIME_API}/${RUNTIME_PATH}/invocation/${REQUEST_ID}/response" > /dev/null
3333
}
3434

3535
# Make sure handler file exists
@@ -58,8 +58,10 @@ fi
5858
# Processing
5959
while true
6060
do
61-
HEADERS="$(mktemp)"
62-
RESPONSE="$(mktemp)"
61+
HEADERS="/tmp/headers-$(date +'%s')"
62+
RESPONSE="/tmp/response-$(date +'%s')"
63+
touch $HEADERS
64+
touch $RESPONSE
6365
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/${RUNTIME_PATH}/invocation/next")
6466
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
6567
# Export some additional context
@@ -81,4 +83,6 @@ do
8183
# Clean up
8284
rm -f -- "$HEADERS"
8385
rm -f -- "$RESPONSE"
86+
unset HEADERS
87+
unset RESPONSE
8488
done

0 commit comments

Comments
 (0)