Merge master

This commit is contained in:
Jonathan Turner 2019-08-22 05:09:23 +12:00
commit 73e3402e2f
2 changed files with 24 additions and 20 deletions

View File

@ -2,8 +2,7 @@ use crate::commands::WholeStreamCommand;
use crate::errors::ShellError;
use crate::object::process::process_dict;
use crate::prelude::*;
#[allow(unused)]
use sysinfo::{RefreshKind, SystemExt};
use sysinfo::SystemExt;
pub struct PS;
@ -35,6 +34,7 @@ fn ps(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream, Sh
#[cfg(not(target_os = "linux"))]
{
use sysinfo::RefreshKind;
let mut sy = sysinfo::System::new_with_specifics(RefreshKind::new().with_processes());
sy.refresh_processes();

View File

@ -200,11 +200,15 @@ impl Shell for FilesystemShell {
dst,
recursive,
}: CopyArgs,
RunnablePerItemContext { name, .. }: &RunnablePerItemContext,
context: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> {
let source = src.item.clone();
let mut destination = dst.item.clone();
let name_span = name;
let name_span = context.name;
let mut source = PathBuf::from(context.shell_manager.path());
let mut destination = PathBuf::from(context.shell_manager.path());
source.push(&src.item);
destination.push(&dst.item);
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
Ok(files) => files.collect(),
@ -514,14 +518,15 @@ impl Shell for FilesystemShell {
fn mv(
&self,
MoveArgs { src, dst }: MoveArgs,
RunnablePerItemContext {
name,
shell_manager,
}: &RunnablePerItemContext,
context: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> {
let source = src.item.clone();
let mut destination = dst.item.clone();
let name_span = name;
let name_span = context.name;
let mut source = PathBuf::from(context.shell_manager.path());
let mut destination = PathBuf::from(context.shell_manager.path());
source.push(&src.item);
destination.push(&dst.item);
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
Ok(files) => files.collect(),
@ -534,10 +539,6 @@ impl Shell for FilesystemShell {
}
};
if "." == destination.to_string_lossy() {
destination = PathBuf::from(shell_manager.path());
}
let destination_file_name = {
match destination.file_name() {
Some(name) => PathBuf::from(name),
@ -821,10 +822,13 @@ impl Shell for FilesystemShell {
fn rm(
&self,
RemoveArgs { target, recursive }: RemoveArgs,
RunnablePerItemContext { name, .. }: &RunnablePerItemContext,
context: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> {
let path = target.item.clone();
let name_span = name;
let name_span = context.name;
let mut path = PathBuf::from(context.shell_manager.path());
path.push(&target.item);
let file = path.to_string_lossy();