fix mismatched types---make check passes on x86_64!

This commit is contained in:
Niko Matsakis 2011-11-15 08:06:10 -08:00
parent 25bc37cef9
commit c572b793fe
3 changed files with 18 additions and 17 deletions

View File

@ -17,6 +17,7 @@
import std::comm::port;
import std::comm::send;
import std::comm::recv;
import std::ctypes::{pid_t, fd_t};
export handle;
export mk;
@ -33,7 +34,8 @@
tag request { exec([u8], [u8], [[u8]], chan<response>); stop; }
type response = {pid: int, infd: int, outfd: int, errfd: int};
type response = {pid: pid_t, infd: fd_t,
outfd: fd_t, errfd: fd_t};
fn mk() -> handle {
let setupport = port();
@ -71,7 +73,7 @@ fn run(handle: handle, lib_path: str, prog: str, args: [str],
ret {status: status, out: output, err: errput};
}
fn writeclose(fd: int, s: option::t<str>) {
fn writeclose(fd: fd_t, s: option::t<str>) {
if option::is_some(s) {
let writer = io::new_writer(io::fd_buf_writer(fd, option::none));
writer.write_str(option::get(s));
@ -80,7 +82,7 @@ fn writeclose(fd: int, s: option::t<str>) {
os::close(fd);
}
fn readclose(fd: int) -> str {
fn readclose(fd: fd_t) -> str {
// Copied from run::program_output
let file = os::fd_FILE(fd);
let reader = io::new_reader(io::FILE_buf_reader(file, option::none));
@ -137,7 +139,7 @@ fn worker(p: port<request>) {
os::close(pipe_in.in);
os::close(pipe_out.out);
os::close(pipe_err.out);
if pid == -1 {
if pid == -1i32 {
os::close(pipe_in.out);
os::close(pipe_out.in);
os::close(pipe_err.in);

View File

@ -41,16 +41,14 @@ fn getenv(n: str) -> option::t<str> unsafe {
#[cfg(target_os = "macos")]
fn setenv(n: str, v: str) {
// FIXME (868)
let _: () =
str::as_buf(n,
// FIXME (868)
{|nbuf|
let _: () =
str::as_buf(v,
{|vbuf|
os::libc::setenv(nbuf, vbuf, 1i32);
});
});
str::as_buf(
n,
// FIXME (868)
{|nbuf|
str::as_buf(
v,
{|vbuf|
os::libc::setenv(nbuf, vbuf, 1i32)})});
}
#[cfg(target_os = "win32")]

View File

@ -15,8 +15,8 @@
#[abi = "cdecl"]
native mod rustrt {
fn rust_run_program(argv: *sbuf, in_fd: fd_t, out_fd: fd_t, err_fd: fd_t) ->
pid_t;
fn rust_run_program(argv: *sbuf, in_fd: fd_t,
out_fd: fd_t, err_fd: fd_t) -> pid_t;
}
/* Section: Types */
@ -115,7 +115,8 @@ fn arg_vec(prog: str, args: [@str]) -> [sbuf] {
The process id of the spawned process
*/
fn spawn_process(prog: str, args: [str], in_fd: fd_t, out_fd: fd_t, err_fd: fd_t)
fn spawn_process(prog: str, args: [str], in_fd: fd_t,
out_fd: fd_t, err_fd: fd_t)
-> pid_t unsafe {
// Note: we have to hold on to these vector references while we hold a
// pointer to their buffers