Skip to content

Commit a18b18c

Browse files
authored
Merge pull request #17371 from JuliaLang/cb/dbldashparsing
Fix #17366 (cmdline parsing of repeated `--`)
2 parents adbd3ac + 36fccef commit a18b18c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

base/client.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,7 @@ try_include(path::AbstractString) = isfile(path) && include(path)
202202
function process_options(opts::JLOptions)
203203
if !isempty(ARGS)
204204
idxs = find(x -> x == "--", ARGS)
205-
if length(idxs) > 1
206-
println(STDERR, "julia: redundant option terminator `--`")
207-
exit(1)
208-
end
209-
deleteat!(ARGS, idxs)
205+
length(idxs) > 0 && deleteat!(ARGS, idxs[1])
210206
end
211207
repl = true
212208
startup = (opts.startupfile != 2)

test/cmdlineargs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
213213
@test readchomp(`$exename -L $testfile -e 'exit(0)' -- foo -bar --baz`) == "String[\"foo\",\"-bar\",\"--baz\"]"
214214
@test split(readchomp(`$exename -L $testfile $testfile`), '\n') == ["String[\"$(escape(testfile))\"]", "String[]"]
215215
@test !success(`$exename --foo $testfile`)
216-
@test !success(`$exename -L $testfile -e 'exit(0)' -- foo -bar -- baz`)
216+
@test readchomp(`$exename -L $testfile -e 'exit(0)' -- foo -bar -- baz`) == "String[\"foo\",\"-bar\",\"--\",\"baz\"]"
217217
finally
218218
rm(testfile)
219219
end

0 commit comments

Comments
 (0)