"stty: stdin isn't a terminal" errors in job logs under macOS

I need to understand how to set up runners and executors, so I installed gitlab-runner on my Mac laptop by following the official instructions to Install GitLab Runner on macOS and Registering Runners on macOS. I chose the shell executor because it was the simplest. The runner runs, which is great!

Unfortunately, there are these odd stty: stdin isn't a terminal errors in the pipeline output on the command line when run as gitlab-runner exec shell job and in the job log (below). There are few hits from an online search (Google), and no solutions, and I’ve spent [more than] a few hours trying to work out why these errors are being generated and how to resolve them. It’s a bit frustrating. I guess there is some configuration option I’m missing?

Running with gitlab-runner 11.11.1 (1a2b3c4d)
  on <name> Runner <token>
Using Shell executor...
stty: stdin isn't a terminal
Running on <name>.local...
stty: stdin isn't a terminal
Reinitialized existing Git repository in <path>
Fetching changes...
From <remote-URL>
   <hash>..<hash>  master     -> origin/master
Checking out <hash> as master...

Skipping Git submodules setup
stty: stdin isn't a terminal
stty: stdin isn't a terminal
stty: stdin isn't a terminal
<script entry commands>
stty: stdin isn't a terminal
stty: stdin isn't a terminal

After several hours of effort, I finally tracked this down to the stty -ixon entry in my .bash_profile. Wrapping that entry in a test for an interactive login shell (as follows) fixed the problem

if [ -n "$PS1" ] then
    stty -ixon
fi

What was happening was gitlab-runner invokes bash as a non-inter-active shell with the --login option, per the information alluded to on the Shells supported by GitLab Runner page and also from the debug output (below). The key point here is that the non-interactive bash --login shell:

“… first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.”
— bash manual page

It seems that gitlab-runner invokes bash --login several times (once per shell operation?) and each time it read my ~/.bash_profile file and executed the stty -ixon entry in a non-interactive shell.

Partial debug output from gitlab-runner --debug exec shell <job>

Shell configuration: environment: []
dockercommand:
- sh
- -c"if [ -x /usr/local/bin/bash ]; then
	exec /usr/local/bin/bash --login
elif [ -x /usr/bin/bash ]; then
	exec /usr/bin/bash --login
elif [ -x /bin/bash ]; then
	exec /bin/bash --login
elif [ -x /usr/local/bin/sh ]; then
	exec /usr/local/bin/sh --login
elif [ -x /usr/bin/sh ]; then
	exec /usr/bin/sh --login
elif [ -x /bin/sh ]; then
	exec /bin/sh --login
elif [ -x /busybox/sh ]; then
	exec /busybox/sh --login
else
	echo shell not found
	exit 1
fi"
command: bash
arguments:
- --login
passfile: false
extension: ""
  job=1 project=0