You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the detailed write-up! I fixed this in ajalt/mordant#188, and I'll be making a bugfix release of mordant soon, so you can use it without waiting for a clikt release.
I also updated the clikt docs with your recommendation.
Summary
Using a Bash redirect with an argument file (@argfile) produces an error
Error: /dev/fd/63 not found
.Environment
Clikt: 4.4.0
Kotlin: 1.9.22
Platform: Tested on JVM with Linux. Unsure about others.
Code
The following code demonstraits this error:
src/main/kotlin/Main.kt
:build.gradle.kts
:Actual Output
Expected Output
Workaround
Uncommenting the
init
line inMain
produces the expected output.Cause
The default
argumentFileReader
is atclikt/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/Context.kt
Lines 238 to 239 in 2f88278
This calls
readArgumentFile
inMordantContext.kt
atclikt/clikt-mordant/src/commonMain/kotlin/com/github/ajalt/clikt/core/MordantContext.kt
Line 55 in 2f88278
That calls
MultiplatformSystem.readFileAsUtf8()
at https://github.com/ajalt/mordant/blob/d24d2fa2794d57ac92e8a59445fe408ca0a598f1/mordant/src/commonMain/kotlin/com/github/ajalt/mordant/platform/MultiplatformSystem.kt#L34-L41That calls
readFileIfExists
at https://github.com/ajalt/mordant/blob/d24d2fa2794d57ac92e8a59445fe408ca0a598f1/mordant/src/jvmMain/kotlin/com/github/ajalt/mordant/internal/MppInternal.jvm.kt#L151-L155Which finally calls
java.io.File.isFile()
which returnsfalse
on pipes and devices.Recommended Fix
In https://github.com/ajalt/mordant/blob/d24d2fa2794d57ac92e8a59445fe408ca0a598f1/mordant/src/jvmMain/kotlin/com/github/ajalt/mordant/internal/MppInternal.jvm.kt#L151-L155, instead of calling
isFile()
, catch theFileNotFoundException
when opening the file.Note
The following documentation should be updated to reflect whatever fix is made here.
clikt/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CoreCliktCommand.kt
Lines 26 to 30 in 2f88278
The text was updated successfully, but these errors were encountered: