Change:
For example, this program prints on unix, and on windows:
The appears to be different on windows for both libgreen and libnative.
I believe this happens because the arguments end up being quoted for Windows. Simplest fix would be to drop empty arguments. Thoughts?
(Alternatively, we could quote empty arguments on Unix.)
I would expect the empty arguments to be passed through as significant argument position. I ran into this in cargo because passed on unix but on windows it would try to consume the next argument for the test args. It looks like to fix this we just need to alter to see if the argument is 0-length, and if so we quote it. Libuv already does . I'm investigating a fix for libgreen, it looks like it should be working...

Discussion:
return cmd; fn append_arg(cmd: &mut String, arg: &str) { <del> let quote = arg.chars().any(|c| c == ' ' || c == 't'); </del> <ins> // If an argument has 0 characters then we need to quote it to ensure // that it actually gets passed through on the command line or otherwise // it will be dropped entirely when parsed on the other end. let quote = arg.chars().any(|c| c == ' ' || c == 't') || arg.len() == 0; </ins> if quote { cmd.push_char('"'); }

let sockaddr_p = &mut sockaddr as *mut libc::sockaddr_storage; match unsafe { <del> getsockname(handle, sockaddr_p as *mut libc::sockaddr, &mut namelen) </del> <ins> getsockname(&*handle, sockaddr_p as *mut libc::sockaddr, &mut namelen) </ins> } { 0 => Ok(sockaddr_to_addr(&sockaddr, namelen as uint)), n => Err(uv_error_to_io_error(UvError(n)))

let _len = addr_to_sockaddr(address, &mut storage); let res = unsafe { let addr_p = &storage as *const _ as *const libc::sockaddr; <del> uvll::uv_tcp_bind(l.handle, addr_p) </del> <ins> uvll::uv_tcp_bind(l.handle, addr_p, 0) </ins> }; return match res { 0 => Ok(l.install()),

UV_FS, UV_WORK, UV_GETADDRINFO, <ins> UV_GETNAMEINFO, </ins> UV_REQ_TYPE_MAX }

UV_UDP_SEND, UV_FS, UV_WORK, <ins> UV_GETNAMEINFO, </ins> UV_GETADDRINFO, UV_ACCEPT, UV_FS_EVENT_REQ,

pub fn uv_tcp_init(l: *mut uv_loop_t, h: *mut uv_tcp_t) -> c_int; pub fn uv_tcp_connect(c: *mut uv_connect_t, h: *mut uv_tcp_t, addr: *const sockaddr, cb: uv_connect_cb) -> c_int; <del> pub fn uv_tcp_bind(t: *mut uv_tcp_t, addr: *const sockaddr) -> c_int; </del> <ins> pub fn uv_tcp_bind(t: *mut uv_tcp_t, addr: *const sockaddr, flags: c_uint) -> c_int; </ins> pub fn uv_tcp_nodelay(h: *mut uv_tcp_t, enable: c_int) -> c_int; pub fn uv_tcp_keepalive(h: *mut uv_tcp_t, enable: c_int, delay: c_uint) -> c_int; pub fn uv_tcp_simultaneous_accepts(h: *mut uv_tcp_t, enable: c_int) -> c_int; <del> pub fn uv_tcp_getsockname(h: *mut uv_tcp_t, name: *mut sockaddr, </del> <ins> pub fn uv_tcp_getsockname(h: *const uv_tcp_t, name: *mut sockaddr, </ins> len: *mut c_int) -> c_int; <del> pub fn uv_tcp_getpeername(h: *mut uv_tcp_t, name: *mut sockaddr, </del> <ins> pub fn uv_tcp_getpeername(h: *const uv_tcp_t, name: *mut sockaddr, </ins> len: *mut c_int) -> c_int; // udp bindings

pub fn uv_udp_set_multicast_ttl(handle: *mut uv_udp_t, ttl: c_int) -> c_int; pub fn uv_udp_set_ttl(handle: *mut uv_udp_t, ttl: c_int) -> c_int; pub fn uv_udp_set_broadcast(handle: *mut uv_udp_t, on: c_int) -> c_int; <del> pub fn uv_udp_getsockname(h: *mut uv_udp_t, name: *mut sockaddr, </del> <ins> pub fn uv_udp_getsockname(h: *const uv_udp_t, name: *mut sockaddr, </ins> len: *mut c_int) -> c_int; // timer bindings

<del> Subproject commit 43495892ded622de51eba7362c5ffae1ed50c9cc </del> <ins> Subproject commit dec0561d198d86a274b1067b53b64fea3c659202 </ins>

use std::os; use std::task::TaskBuilder; <del> // FIXME(#15149) libgreen still needs to be update. There is an open PR for it //               but it is not yet merged. // green_start!(main) </del> <ins> green_start!(main) </ins> fn main() { // If we're the child, make sure we were invoked correctly

<ins> // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(phase)] #[phase(plugin)] extern crate green; extern crate native; use native::NativeTaskBuilder; use std::io::{process, Command}; use std::os; use std::task::TaskBuilder; green_start!(main) fn main() { let len = os::args().len(); if len == 1 { test(); let (tx, rx) = channel(); TaskBuilder::new().native().spawn(proc() { tx.send(test()); }); rx.recv(); } else { assert_eq!(len, 3); } } fn test() { let status = Command::new(os::self_exe_name().unwrap()) .arg("foo").arg("") .stdout(process::InheritFd(1)) .stderr(process::InheritFd(2)) .status().unwrap(); assert!(status.success()); } </ins>