forked from extern/nushell
This reverts commit 5d00ecef56
.
This commit is contained in:
parent
eac5f62959
commit
83458510a9
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2573,7 +2573,6 @@ dependencies = [
|
|||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"sha2 0.10.2",
|
"sha2 0.10.2",
|
||||||
"shadow-rs",
|
"shadow-rs",
|
||||||
"signal-hook",
|
|
||||||
"sqlparser",
|
"sqlparser",
|
||||||
"strip-ansi-escapes",
|
"strip-ansi-escapes",
|
||||||
"sysinfo 0.23.13",
|
"sysinfo 0.23.13",
|
||||||
|
@ -92,7 +92,6 @@ sqlparser = { version = "0.16.0", features = ["serde"], optional = true }
|
|||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
umask = "2.0.0"
|
umask = "2.0.0"
|
||||||
users = "0.11.0"
|
users = "0.11.0"
|
||||||
signal-hook = { version = "0.3.14", default-features = false }
|
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies.trash]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies.trash]
|
||||||
version = "2.1.3"
|
version = "2.1.3"
|
||||||
|
@ -194,9 +194,6 @@ impl ExternalCommand {
|
|||||||
let (stderr_tx, stderr_rx) = mpsc::sync_channel(OUTPUT_BUFFERS_IN_FLIGHT);
|
let (stderr_tx, stderr_rx) = mpsc::sync_channel(OUTPUT_BUFFERS_IN_FLIGHT);
|
||||||
let (exit_code_tx, exit_code_rx) = mpsc::channel();
|
let (exit_code_tx, exit_code_rx) = mpsc::channel();
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
let (exit_status_tx, exit_status_rx) = mpsc::channel();
|
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
// If this external is not the last expression, then its output is piped to a channel
|
// If this external is not the last expression, then its output is piped to a channel
|
||||||
// and we create a ListStream that can be consumed
|
// and we create a ListStream that can be consumed
|
||||||
@ -286,9 +283,6 @@ impl ExternalCommand {
|
|||||||
span,
|
span,
|
||||||
)),
|
)),
|
||||||
Ok(x) => {
|
Ok(x) => {
|
||||||
#[cfg(unix)]
|
|
||||||
let _ = exit_status_tx.send(x);
|
|
||||||
|
|
||||||
if let Some(code) = x.code() {
|
if let Some(code) = x.code() {
|
||||||
let _ = exit_code_tx.send(Value::Int {
|
let _ = exit_code_tx.send(Value::Int {
|
||||||
val: code as i64,
|
val: code as i64,
|
||||||
@ -310,26 +304,6 @@ impl ExternalCommand {
|
|||||||
let stderr_receiver = ChannelReceiver::new(stderr_rx);
|
let stderr_receiver = ChannelReceiver::new(stderr_rx);
|
||||||
let exit_code_receiver = ValueReceiver::new(exit_code_rx);
|
let exit_code_receiver = ValueReceiver::new(exit_code_rx);
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
{
|
|
||||||
use signal_hook::low_level::signal_name;
|
|
||||||
use std::os::unix::process::ExitStatusExt;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
// The receiver will block 100ms if there's no sender
|
|
||||||
if let Ok(status) = exit_status_rx.recv_timeout(Duration::from_millis(100)) {
|
|
||||||
if status.core_dumped() {
|
|
||||||
if let Some(sig) = status.signal().and_then(signal_name) {
|
|
||||||
return Err(ShellError::ExternalCommand(
|
|
||||||
format!("{sig} (core dumped)"),
|
|
||||||
"Child process core dumped".to_string(),
|
|
||||||
span,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(PipelineData::ExternalStream {
|
Ok(PipelineData::ExternalStream {
|
||||||
stdout: if redirect_stdout {
|
stdout: if redirect_stdout {
|
||||||
Some(RawStream::new(
|
Some(RawStream::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user