diff --git a/base/cmd.jl b/base/cmd.jl index da29c732c7f26..0e4ec119109f1 100644 --- a/base/cmd.jl +++ b/base/cmd.jl @@ -14,7 +14,7 @@ struct Cmd <: AbstractCmd env::Union{Vector{String},Nothing} dir::String cpus::Union{Nothing,Vector{UInt16}} - Cmd(exec::Vector{String}) = + Cmd(exec::Vector{<:AbstractString}) = new(exec, false, 0x00, nothing, "", nothing) Cmd(cmd::Cmd, ignorestatus, flags, env, dir, cpus = nothing) = new(cmd.exec, ignorestatus, flags, env, diff --git a/test/spawn.jl b/test/spawn.jl index 4ae4b3368bef6..9d58b32976357 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -1032,3 +1032,10 @@ let effects = Base.infer_effects(x -> `a $x`, (Any,)) @test !Core.Compiler.is_noub(effects) @test !Core.Compiler.is_consistent(effects) end + +# Test that Cmd accepts various AbstractStrings +@testset "AbstractStrings" begin + args = split("-l /tmp") + @assert eltype(args) != String + @test Cmd(["ls", args...]) == `ls -l /tmp` +end