Have a weird situation where the same text is repe...
# kotlin-native
n
Have a weird situation where the same text is repeated when printing a Kotlin String, eg:
Copy code
./jmonitor.kexe --io-metrics Main
I/O metrics for Main:
* Characters Read: 1142215787
* Characters Written: 2559364802
* Total Read System Calls: 229852
* Total Write System Calls: 148106
* Total Bytes Read: 533704704
* Total Bytes Written: 1415086080
* cancelled_Total Bytes Written: 12288
Note that
Total Bytes Written
is repeated twice. What could cause text to be repeated in a Kotlin String?
Can find the project here: https://gitlab.com/napperley/jmonitor
m
And what do you expect, here "write bytes" were replaced twice:
Copy code
"write_bytes" in tmp -> tmp.replace("write_bytes", bytesWrittenStr)
    "cancelled_write_bytes" in tmp -> tmp.replace("cancelled_write_bytes", writtenCancelledStr)
Replace "cancelled... first - this will not happen.
n
Should have seen this one (a very subtle difference) coming 🤦‍♂️ . One of the hazards when there is no API available and the only way to get the data is through file pipes, so one could say that the program is "pipely typed" 😬 .
Moved the bottom condition above the previous one. It is a good thing that conditions in when automatically break.