diff --git a/Project.toml b/Project.toml index b2df734..31d4d1b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Pipelines" uuid = "ef544631-5c6f-4e9b-994c-12e7a4cd724c" authors = ["Jiacheng Chuan "] -version = "0.11.0" +version = "0.11.1" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 82e80dd..13f5c5d 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -1,5 +1,9 @@ # Change Log +## v0.11.1 + +- Fix: use `tryisfile(f)` instead of `isfile(f)` in `cmd_to_run_id_lines` because the latter might cause name too long error. + ## v0.11.0 - Feat/**Breaking**: new method `auto_change_directory(b::Bool)`. It is necessary because changing directory is not thread-safe in Julia. It was set to `false` in v0.11.0. To make your code compatible with previous version, you can add `Pipelines.auto_change_directory(true)` at the beginning of your code, or use full paths through out your code (recommended). diff --git a/src/run_id_file.jl b/src/run_id_file.jl index f56265d..c4e8c3b 100644 --- a/src/run_id_file.jl +++ b/src/run_id_file.jl @@ -265,6 +265,18 @@ function write_run_id_line(io, arg_name::AbstractString, file::AbstractString, f end write_run_id_line(io, arg_name::AbstractPath, file::AbstractString, first_char::String; skip_ext::Vector = RUN_ID_LINE_SKIP_EXTENSION) = write_run_id_line(io, string(arg_name), file, first_char; skip_ext = skip_ext) +""" + tryisfile(f) +if name too long +""" +function tryisfile(f) + try + isfile(f) + catch + false + end +end + """ cmd_to_run_id_lines(io::IO, arg_name::AbstractString, cmd::Base.AbstractCmd, first_char::String) @@ -303,14 +315,14 @@ function cmd_to_run_id_lines(io::IO, arg_name::AbstractString, cmd::Cmd, first_c end f = m.captures[1] - if isfile(f) + if tryisfile(f) write_run_id_line(io, arg_name, f, first_char) else # check whether it is file1,file2 or file1;file2 splited = split(f, CMD_FILE_SPLITER) length(splited) == 1 && continue for s in splited - if isfile(s) + if tryisfile(s) write_run_id_line(io, arg_name, s, first_char) end end @@ -318,14 +330,14 @@ function cmd_to_run_id_lines(io::IO, arg_name::AbstractString, cmd::Cmd, first_c continue end - if isfile(arg) + if tryisfile(arg) write_run_id_line(io, arg_name, arg, first_char) else # check whether it is file1,file2 or file1;file2 splited = split(arg, CMD_FILE_SPLITER) length(splited) == 1 && continue for f in splited - if isfile(f) + if tryisfile(f) write_run_id_line(io, arg_name, f, first_char) end end @@ -345,7 +357,7 @@ function cmd_to_run_id_lines(io::IO, arg_name::AbstractString, h::Base.TTY, firs nothing end function cmd_to_run_id_lines(io::IO, arg_name::AbstractString, h::Base.FileRedirect, first_char::String) # h: handle property of CmdRedirect - if isfile(h.filename) + if tryisfile(h.filename) write_run_id_line(io, arg_name, h.filename, first_char) end end