Skip to content

Commit 991945d

Browse files
authored
run.sh: Preserve spaces in passed arguments
1 parent 878c64c commit 991945d

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
@@ -213,60 +213,70 @@ doorstop_bool() {
213213
}
214214

215215
# Read from command line
216-
while :; do
216+
i=0; max=$#
217+
while [ $i -lt $max ]; do
217218
case "$1" in
218219
--doorstop_enabled) # For backwards compatibility. Renamed to --doorstop-enabled
219220
enabled="$(doorstop_bool "$2")"
220221
shift
222+
i=$((i+1))
221223
;;
222224
--doorstop_target_assembly) # For backwards compatibility. Renamed to --doorstop-target-assembly
223225
target_assembly="$2"
224226
shift
227+
i=$((i+1))
225228
;;
226229
--doorstop-enabled)
227230
enabled="$(doorstop_bool "$2")"
228231
shift
232+
i=$((i+1))
229233
;;
230234
--doorstop-target-assembly)
231235
target_assembly="$2"
232236
shift
237+
i=$((i+1))
233238
;;
234239
--doorstop-boot-config-override)
235240
boot_config_override="$2"
236241
shift
242+
i=$((i+1))
237243
;;
238244
--doorstop-mono-dll-search-path-override)
239245
dll_search_path_override="$2"
240246
shift
247+
i=$((i+1))
241248
;;
242249
--doorstop-mono-debug-enabled)
243250
debug_enable="$(doorstop_bool "$2")"
244251
shift
252+
i=$((i+1))
245253
;;
246254
--doorstop-mono-debug-suspend)
247255
debug_suspend="$(doorstop_bool "$2")"
248256
shift
257+
i=$((i+1))
249258
;;
250259
--doorstop-mono-debug-address)
251260
debug_address="$2"
252261
shift
262+
i=$((i+1))
253263
;;
254264
--doorstop-clr-runtime-coreclr-path)
255265
coreclr_path="$2"
256266
shift
267+
i=$((i+1))
257268
;;
258269
--doorstop-clr-corlib-dir)
259270
corlib_dir="$2"
260271
shift
272+
i=$((i+1))
261273
;;
262274
*)
263-
if [ -z "$1" ]; then
264-
break
265-
fi
266-
rest_args="$rest_args $1"
275+
set -- "$@" "$1"
267276
;;
268277
esac
269278
shift
279+
i=$((i+1))
270280
done
271281

272282
# Move variables to environment
@@ -299,5 +309,4 @@ else
299309
export DYLD_INSERT_LIBRARIES="${doorstop_name}:${DYLD_INSERT_LIBRARIES}"
300310
fi
301311

302-
# shellcheck disable=SC2086
303-
exec "$executable_path" $rest_args
312+
exec "$executable_path" "$@"

0 commit comments

Comments
 (0)