Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--cookie-jar FILE doesn't work if intermediate directories don't exist #3637

Open
jcamiel opened this issue Jan 24, 2025 · 0 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 24, 2025

When exporting cookies from a run to SOME_FILE export is failing if SOME_FILE has non-existing directory:

$ echo 'HEAD https://hurl.dev' | hurl --cookie-jar /tmp/a/b/c/out.txt
error: Issue writing to /tmp/a/b/c/out.txt: Os { code: 2, kind: NotFound, message: "No such file or directory" }

--cookie-jar should works like --curll which create intermediate directories:

$ echo 'HEAD https://hurl.dev' | hurl --curl /tmp/a/b/c/out.txt

Note: we could try while fixing this bug to mutualize the code that create a file and it's indermediate directories:

 // We ensure that parent folder is created.
    if let Some(parent) = filename.parent() {
        match std::fs::create_dir_all(parent) {
            Ok(_) => {}
            Err(err) => {
                return Err(ReportError::from_error(
                    err,
                    filename,
                    "Issue writing TAP report",
                ))
            }
        }
    }
    let mut file = match File::create(filename) {
        Ok(f) => f,
        Err(e) => {
            return Err(ReportError::from_error(
                e,
                filename,
                "Issue writing TAP report",
            ))
        }
    };
@jcamiel jcamiel added bug Something isn't working good first issue Good for newcomers labels Jan 24, 2025
@jcamiel jcamiel changed the title --cookie-jar FILE doesn't work if intermediate directory don't exist --cookie-jar FILE doesn't work if intermediate directories don't exist Jan 24, 2025
@jcamiel jcamiel added this to the 6.1.0 milestone Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant