Skip to content

Commit 7b69019

Browse files
committed
run.sh: Preserve spaces in passed arguments
1 parent 431d8aa commit 7b69019

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

assets/nix/run.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,60 +189,70 @@ doorstop_bool() {
189189
}
190190

191191
# Read from command line
192-
while :; do
192+
i=0; max=$#
193+
while [ $i -lt $max ]; do
193194
case "$1" in
194195
--doorstop_enabled) # For backwards compatibility. Renamed to --doorstop-enabled
195196
enabled="$(doorstop_bool "$2")"
196197
shift
198+
i=$((i+1))
197199
;;
198200
--doorstop_target_assembly) # For backwards compatibility. Renamed to --doorstop-target-assembly
199201
target_assembly="$2"
200202
shift
203+
i=$((i+1))
201204
;;
202205
--doorstop-enabled)
203206
enabled="$(doorstop_bool "$2")"
204207
shift
208+
i=$((i+1))
205209
;;
206210
--doorstop-target-assembly)
207211
target_assembly="$2"
208212
shift
213+
i=$((i+1))
209214
;;
210215
--doorstop-boot-config-override)
211216
boot_config_override="$2"
212217
shift
218+
i=$((i+1))
213219
;;
214220
--doorstop-mono-dll-search-path-override)
215221
dll_search_path_override="$2"
216222
shift
223+
i=$((i+1))
217224
;;
218225
--doorstop-mono-debug-enabled)
219226
debug_enable="$(doorstop_bool "$2")"
220227
shift
228+
i=$((i+1))
221229
;;
222230
--doorstop-mono-debug-suspend)
223231
debug_suspend="$(doorstop_bool "$2")"
224232
shift
233+
i=$((i+1))
225234
;;
226235
--doorstop-mono-debug-address)
227236
debug_address="$2"
228237
shift
238+
i=$((i+1))
229239
;;
230240
--doorstop-clr-runtime-coreclr-path)
231241
coreclr_path="$2"
232242
shift
243+
i=$((i+1))
233244
;;
234245
--doorstop-clr-corlib-dir)
235246
corlib_dir="$2"
236247
shift
248+
i=$((i+1))
237249
;;
238250
*)
239-
if [ -z "$1" ]; then
240-
break
241-
fi
242-
rest_args="$rest_args $1"
251+
set -- "$@" "$1"
243252
;;
244253
esac
245254
shift
255+
i=$((i+1))
246256
done
247257

248258
# Move variables to environment
@@ -275,5 +285,4 @@ else
275285
export DYLD_INSERT_LIBRARIES="${doorstop_name}:${DYLD_INSERT_LIBRARIES}"
276286
fi
277287

278-
# shellcheck disable=SC2086
279-
exec "$executable_path" $rest_args
288+
exec "$executable_path" "$@"

0 commit comments

Comments
 (0)