mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 23:09:51 +02:00
Remove --encoding
argument during register plugin (#6486)
* first implement new plugin protocol core logic * fix debug body construct * fix output message from plugin * finish plugin commands calling * fix tests and adjust plugin_custom_value call * fmt code * fmt code, fix clippy * add FIXME comment * change from FIXME to TODO
This commit is contained in:
@@ -3,10 +3,7 @@ use std::path::PathBuf;
|
||||
use nu_protocol::{CustomValue, ShellError, Value};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{
|
||||
plugin::{call_plugin, create_command},
|
||||
EncodingType,
|
||||
};
|
||||
use crate::plugin::{call_plugin, create_command, get_plugin_encoding};
|
||||
|
||||
use super::{PluginCall, PluginData, PluginResponse};
|
||||
|
||||
@@ -32,8 +29,6 @@ pub struct PluginCustomValue {
|
||||
#[serde(skip)]
|
||||
pub shell: Option<PathBuf>,
|
||||
#[serde(skip)]
|
||||
pub encoding: EncodingType,
|
||||
#[serde(skip)]
|
||||
pub source: String,
|
||||
}
|
||||
|
||||
@@ -72,8 +67,19 @@ impl CustomValue for PluginCustomValue {
|
||||
data: self.data.clone(),
|
||||
span,
|
||||
});
|
||||
let encoding = {
|
||||
let stdout_reader = match &mut child.stdout {
|
||||
Some(out) => out,
|
||||
None => {
|
||||
return Err(ShellError::PluginFailedToLoad(
|
||||
"Plugin missing stdout reader".into(),
|
||||
))
|
||||
}
|
||||
};
|
||||
get_plugin_encoding(stdout_reader)?
|
||||
};
|
||||
|
||||
let response = call_plugin(&mut child, plugin_call, &self.encoding, span).map_err(|err| {
|
||||
let response = call_plugin(&mut child, plugin_call, &encoding, span).map_err(|err| {
|
||||
ShellError::GenericError(
|
||||
format!(
|
||||
"Unable to decode call for {} to get base value",
|
||||
|
Reference in New Issue
Block a user