Skip to content

Commit 4dee102

Browse files
committed
use new get_args
1 parent 7daf890 commit 4dee102

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libstd/sys/wasi/args.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ pub unsafe fn cleanup() {
1212
}
1313

1414
pub struct Args {
15-
iter: vec::IntoIter<Vec<u8>>,
15+
iter: vec::IntoIter<OsString>,
1616
_dont_send_or_sync_me: PhantomData<*mut ()>,
1717
}
1818

1919
/// Returns the command line arguments
2020
pub fn args() -> Args {
21+
let mut buf = Vec::new();
22+
let _ = wasi::get_args(|arg| buf.push(OsString::from_vec(arg.to_vec())));
2123
Args {
22-
iter: wasi::get_args().unwrap_or(Vec::new()).into_iter(),
24+
iter: buf.into_iter(),
2325
_dont_send_or_sync_me: PhantomData
2426
}
2527
}
@@ -33,7 +35,7 @@ impl Args {
3335
impl Iterator for Args {
3436
type Item = OsString;
3537
fn next(&mut self) -> Option<OsString> {
36-
self.iter.next().map(OsString::from_vec)
38+
self.iter.next()
3739
}
3840
fn size_hint(&self) -> (usize, Option<usize>) {
3941
self.iter.size_hint()

0 commit comments

Comments
 (0)