GithubHelp home page GithubHelp logo

Timeout support about assert_cmd HOT 4 CLOSED

assert-rs avatar assert-rs commented on June 28, 2024 2
Timeout support

from assert_cmd.

Comments (4)

epage avatar epage commented on June 28, 2024

See discussion at assert-rs/assert_cli#67

from assert_cmd.

epage avatar epage commented on June 28, 2024

From previous thread

Looks like this will be pretty trivial
https://crates.io/crates/wait-timeout

Nevermind, it doesn't support getting the output and it doesn't look like it will in the foreseeable future
alexcrichton/wait-timeout#4

from assert_cmd.

vincentdephily avatar vincentdephily commented on June 28, 2024

For my use, I'm simply looping through all my currently-live commands and calling thread::sleep(10ms) before looping again. Not pretty but it works. I've found 10ms to be useful even on my slow-ish CI.

A better solution would use futures, but I'm not sure what futures are available to wait for process exit. Presumably, implementing those futures is assrt_cmd's job.

Note that I use a generic CmdCond enum which can describe a timeout condition but also "when that other command has exited" or "when that file matches a predicate".

You can steal code from https://gist.github.com/vincentdephily/592546c41ff9713adff234e5535aa6d4

from assert_cmd.

dylni avatar dylni commented on June 28, 2024

@epage I created a crate that should help with this:
https://crates.io/crates/process_control

You can use Child::with_output_timeout to get output from a process with a timeout.

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.