Skip to content

Commit

Permalink
fath2boinc: change error propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
div72 committed Nov 1, 2022
1 parent 92ae6c6 commit 8b92d9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fath2boinc.v
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn main() {

println("Loaded $count entries from local user data.")

for line in os.read_lines(os.args[2])? {
for line in os.read_lines(os.args[2])! {
parts := line.split("\t")
// Basic input sanitatization. Protects against XML and CSV injections.
full_name := parts[0].replace(",", "").replace("<", "").replace(">", "")
Expand Down Expand Up @@ -183,16 +183,16 @@ fn main() {
highest_rac.to_xml(mut b)
}
b.writeln("</users>")
os.write_file(os.args[3] + '~', b.str())?
os.mv(os.args[3] + '~', os.args[3])?
os.write_file(os.args[3] + '~', b.str())!
os.mv(os.args[3] + '~', os.args[3])!
println("Updated boinc statistics.")

for _, entries in users {
for entry in entries {
entry.to_csv(mut b)
}
}
os.write_file(os.args[1] + '~', b.str())?
os.mv(os.args[1] + '~', os.args[1])?
os.write_file(os.args[1] + '~', b.str())!
os.mv(os.args[1] + '~', os.args[1])!
println("Updated local statistics.")
}

0 comments on commit 8b92d9f

Please sign in to comment.