Make process-spawning take environments and working directories, remove procsrv task from compiletest.

This commit is contained in:
Graydon Hoare
2012-02-07 18:55:02 -08:00
parent 5131216fa6
commit 93450abb4b
18 changed files with 328 additions and 286 deletions

View File

@@ -1298,15 +1298,6 @@ const tag_five_b: uint = 248u;
const max_five_b: uint = 67108864u;
const tag_six_b: uint = 252u;
// NB: This is intentionally unexported because it's easy to misuse (there's
// no guarantee that the string is rooted). Instead, use as_buf below.
unsafe fn buf(s: str) -> sbuf {
let saddr = ptr::addr_of(s);
let vaddr: *[u8] = ::unsafe::reinterpret_cast(saddr);
let buf = vec::to_ptr(*vaddr);
ret buf;
}
/*
Function: as_buf
@@ -1319,7 +1310,10 @@ Example:
*/
fn as_buf<T>(s: str, f: fn(sbuf) -> T) -> T unsafe {
let buf = buf(s); f(buf)
let v: [u8] = ::unsafe::reinterpret_cast(s);
let r = vec::as_buf(v, f);
::unsafe::leak(v);
r
}
/*

View File

@@ -1077,6 +1077,18 @@ FIXME: We don't need this wrapper
*/
unsafe fn to_ptr<T>(v: [T]) -> *T { ret unsafe::to_ptr(v); }
/*
Function: as_buf
Work with the buffer of a vector. Allows for unsafe manipulation
of vector contents, which is useful for native interop.
*/
fn as_buf<E,T>(v: [const E], f: fn(*E) -> T) -> T unsafe {
let buf = unsafe::to_ptr(v); f(buf)
}
/*
Module: unsafe
*/