How to declare tokio_net::process::Command?

I am trying to use: tokio_net
but tokio_net crate does not exist and tokio::net::process within the latest tokio alpha neither.
Maybe I am just confused about how to declare properly this module thing, or is the documentation actually wrong to suggest tokio_net?

The example given in the docs is:

use tokio_net::process::Command;
let command = Command::new("sh");

and in my Cargo.toml I have:

tokio = "^0.2.0-alpha.6"

What exactly do I have to add either in my Cargo.toml or in my use declarations to make this work?

Did you try?

use tokio::net::process::Command;

Yes, it says "can not find process in net".
That is what I meant by saying that it does not exist either.

You might need to enable the process module. In your cargo.toml change

tokio = "^0.2.0-alpha.6"


version = "^0.2.0-alpha.6"
features = ["process"]

That is more promising but now it complains that future is not implemented for it but of course being able to use this in async-await mode was the reason why I am going into all this trouble in the first place, otherwise I can just use std::process::Command and forget about tokio.

Edit: Thanks to your "features" sugestion, I got it working now. It has to be said though that the documentation is just plain wrong on this point. As to being able to use await, it just needs everything to be put in exactly this order:

	let pubpr = Command::new(&path)
		.expect("tabwrite: failed to publish");
	if !pubpr.success() {  
		return Err(From::from(format!("tabwrite: publish failed status!"))); };

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.