GithubHelp home page GithubHelp logo

How to handle permissions? about assert_cmd HOT 8 CLOSED

milesj avatar milesj commented on June 30, 2024
How to handle permissions?

from assert_cmd.

Comments (8)

epage avatar epage commented on June 30, 2024

I think some more context is needed to be able to help with what you are doing. Where you are writing to and how you are doing it are important factors.

In case you weren't aware, I tend to use https://github.com/assert-rs/assert_fs or https://github.com/assert-rs/trycmd for creating a scratchpad to write to.

from assert_cmd.

milesj avatar milesj commented on June 30, 2024

@epage Not using either of those for this specific test, which is this: https://github.com/milesj/monolith/pull/5/files#diff-9a1f0aa2064ff70580494869ae0fa8a4f7c3e9b26cf3eabdfee35a0d6b17baf7R6-R9

I want to test that this code, which the CLI runs, actually works in a real world use case: https://github.com/milesj/monolith/blob/master/crates/toolchain/src/tools/node.rs#L189-L215 Right now I either get a "Permission denied" or "No such file or directory" error.

from assert_cmd.

epage avatar epage commented on June 30, 2024

Under what conditions do you get each of those errors?

Is this local, CI, or both?

What platforms are you seeing the failure? Know of platforms that work?

btw this is most likely a very specific setup failure or a program bug. I'd recommend tracing in to see which call is failing and verifying the inputs to that call and make sure you are reproducing with those same inputs.

from assert_cmd.

milesj avatar milesj commented on June 30, 2024

@epage It fails locally and in CI, for both mac/linux.

I'll try and trace to debug more.

from assert_cmd.

milesj avatar milesj commented on June 30, 2024

@milesj I think I found the problem, but it does bring up a question. Does assert() wait for the entire child process to complete? Because this test could take many seconds.

Is there a way to write these in an async/await fashion?

from assert_cmd.

epage avatar epage commented on June 30, 2024

Yes, this is for one-shot testing rather than interactive testing, so it waits for the program to finish.

from assert_cmd.

milesj avatar milesj commented on June 30, 2024

This is still happening, but I've narrowed it down to this line: https://github.com/milesj/moon/blob/master/crates/toolchain/src/helpers.rs#L78

It seems like the dirs aren't being created on line 71 and I have no idea why.

This is the entire test https://github.com/milesj/moon/pull/5/files#diff-a31902d06ac6afdddf64feb76dc589f59e39a33434c352de60ba84f8beca4427R16

from assert_cmd.

milesj avatar milesj commented on June 30, 2024

Not sure what changed, but this isn't an issue anymore. Closing.

from assert_cmd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.