Mercurial > crates > systemd-socket
view tests/ordinary.rs @ 4:66c0e10c89fc
Support resolving hostnames
Until now the crate supported only IP addresses and systemd sockets.
This was troublesome because it prevented the popular `localhost:1234`
format. This commit changes the behavior so that if parsing of
`std::net::SocketAddr` fails it attempts to parse it as `hostname:port`.
`bind_*()` methods were also modified to be async because of this.
author | Martin Habovstiak <martin.habovstiak@gmail.com> |
---|---|
date | Fri, 27 Nov 2020 15:05:19 +0100 |
parents | ef8bf41097ac |
children | cfef4593e207 |
line wrap: on
line source
use std::io; use std::ffi::OsStr; use std::process::{Command, Child}; mod comm; enum Test {} impl comm::Test for Test { const SOCKET_ADDR: &'static str = "localhost:4242"; fn spawn_slave(program_name: &OsStr) -> io::Result<Child> { Command::new(program_name) .env("SYSTEMD_SOCKET_INTEGRATION_TEST", "slave") .spawn() } } #[test] fn main() { comm::main::<Test>(); }