Commit f8f85c38 authored by AdminXVII's avatar AdminXVII Committed by Michael Aaron Murphy
Browse files

fix: Bring back redox compilation

parent a9c19446
......@@ -787,7 +787,7 @@ dependencies = [
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lexical 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"liner 0.5.0 (git+https://gitlab.redox-os.org/redox-os/liner)",
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.14.1",
"object-pool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"permutate 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"piston-ai_behavior 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -870,6 +870,11 @@ dependencies = [
"static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.60"
source = "git+https://github.com/rust-lang/libc#c8aa8ec72d631bc35099bcf5d634cf0a0b841be0"
[[package]]
name = "libc"
version = "0.2.60"
......@@ -965,6 +970,17 @@ name = "memoffset"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nix"
version = "0.14.1"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (git+https://github.com/rust-lang/libc)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nix"
version = "0.14.1"
......@@ -2177,6 +2193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum lexical 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93de1b2ed9c7f01aac327bf84542a053b6cd15761defdcfaceb27e1d1b871e74"
"checksum lexical-core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3f8673fab7063c2cac37d299c8a1a7beb720e78f71500098e4a3c137fdf025bf"
"checksum libc 0.2.60 (git+https://github.com/rust-lang/libc)" = "<none>"
"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb"
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
"checksum line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9"
......
This diff is collapsed.
......@@ -38,6 +38,8 @@ members = [ "members/builtins-proc", "members/ranges", "members/scopes-rs", "mem
criterion = "0.2"
serial_test = "*"
serial_test_derive = "*"
[target."cfg(not(target_os = \"redox\"))".dev-dependencies]
# window example
piston-ai_behavior = "0.31"
piston_window = "0.100"
......@@ -86,7 +88,7 @@ structopt = "^0.2"
atty = "0.2"
permutate = "0.3"
xdg = "2.1"
nix = "0.14"
nix = { path = "../nix" }
[target."cfg(all(unix, not(target_os = \"redox\")))".dependencies]
users = "0.9"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// This is based on the sprite example from piston-examples, available at https://github.com/PistonDevelopers/piston-examples
#[cfg(not(target_os = "redox"))]
use std::{cell::RefCell, fs::File, path::Path, rc::Rc};
#[cfg(not(target_os = "redox"))]
use ai_behavior::{Action, Sequence, Wait, WaitForever, While};
#[cfg(not(target_os = "redox"))]
use ion_shell::{
builtins::{BuiltinFunction, Status},
types, Shell,
};
#[cfg(not(target_os = "redox"))]
use piston_window::*;
#[cfg(not(target_os = "redox"))]
use sprite::*;
#[cfg(target_os = "redox")]
// Don't run the test on redox
fn main() {}
#[cfg(not(target_os = "redox"))]
fn main() {
// This is specific to piston. It does not matter
// Skip to the next *****
......
../target/debug/ion
\ No newline at end of file
......@@ -322,7 +322,9 @@ mod tests {
let mut completer = IonFileCompleter::new(None, &shell);
assert_eq!(completer.completions("testing"), vec!["testing/"]);
assert_eq!(completer.completions("testing/file"), vec!["testing/file_with_text"]);
assert_eq!(completer.completions("~"), vec!["~/"]);
if cfg!(not(target_os = "redox")) {
assert_eq!(completer.completions("~"), vec!["~/"]);
}
assert_eq!(completer.completions("tes/fil"), vec!["testing/file_with_text"]);
}
}
......@@ -807,9 +807,6 @@ DESCRIPTION
pub fn isatty(args: &[types::Str], _: &mut Shell<'_>) -> Status {
if args.len() > 1 {
// sys::isatty expects a usize if compiled for redox but otherwise a i32.
#[cfg(target_os = "redox")]
let pid = args[1].parse::<usize>();
#[cfg(not(target_os = "redox"))]
let pid = args[1].parse::<i32>();
match pid {
......
......@@ -428,6 +428,7 @@ fn test_file_is_directory() {
}
#[test]
#[cfg(not(target_os = "redox"))]
fn test_file_is_symlink() {
assert_eq!(file_is_symlink("testing/symlink"), true);
assert_eq!(file_is_symlink("testing/empty_file"), false);
......
......@@ -5,6 +5,7 @@ use std::{
io,
path::{Component, Path, PathBuf},
};
#[cfg(not(target_os = "redox"))]
use users::os::unix::UserExt;
#[derive(Debug, Error)]
......@@ -149,10 +150,13 @@ impl DirectoryStack {
pub fn switch_to_home_directory(&mut self) -> Result<(), DirStackError> {
match env::var_os("HOME") {
Some(home) => self.change_and_push_dir(Path::new(&home)),
#[cfg(not(target_os = "redox"))]
None => users::get_user_by_uid(users::get_current_uid())
.map_or(Err(DirStackError::FailedFetchHome), |user| {
self.change_and_push_dir(user.home_dir())
}),
#[cfg(target_os = "redox")]
None => Err(DirStackError::FailedFetchHome),
}
}
......
......@@ -7,6 +7,7 @@ use crate::{
};
use nix::unistd::{tcsetpgrp, Pid};
use std::{env, fs::File, io::Read, iter::FromIterator};
#[cfg(not(target_os = "redox"))]
use users::os::unix::UserExt;
impl<'a, 'b> Expander for Shell<'b> {
......@@ -227,7 +228,7 @@ impl<'a, 'b> Expander for Shell<'b> {
}
.map(|path| path.to_str().unwrap().into())
.ok_or_else(|| Error::OutOfStack(num))
} else {
} else if cfg!(not(target_os = "redox")) {
let user = if tilde_prefix.is_empty() {
users::get_user_by_uid(users::get_current_uid())
} else {
......@@ -237,6 +238,8 @@ impl<'a, 'b> Expander for Shell<'b> {
Some(user) => Ok(user.home_dir().to_string_lossy().as_ref().into()),
None => Err(Error::HomeNotFound),
}
} else {
Err(Error::HomeNotFound)
}
}
}
......
This diff is collapsed.
This diff is collapsed.
pub mod signals;
#[cfg(target_os = "redox")]
pub const NULL_PATH: &str = "null:";
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
pub const NULL_PATH: &str = "/dev/null";
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment