aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
blob: f721d2b4552e002a2a716816e1fd111d7f01830e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! ref: composer/vendor/symfony/process/Pipes/WindowsPipes.php

use crate::symfony::process::pipes::abstract_pipes::AbstractPipes;
use crate::symfony::process::pipes::pipes_interface::PipesInterface;
use indexmap::IndexMap;
use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};

/// WindowsPipes implementation uses temporary files as handles.
#[derive(Debug)]
pub struct WindowsPipes {
    inner: AbstractPipes,
    files: IndexMap<i64, String>,
    file_handles: IndexMap<i64, PhpResource>,
    lock_handles: IndexMap<i64, PhpResource>,
    read_bytes: IndexMap<i64, i64>,
    have_read_support: bool,
}

impl WindowsPipes {
    pub fn new(_input: PhpMixed, _have_read_support: bool) -> Self {
        // Windows-only path: never constructed on POSIX (DIRECTORY_SEPARATOR is "/").
        todo!()
    }
}

impl PipesInterface for WindowsPipes {
    fn get_descriptors(&mut self) -> Vec<Descriptor> {
        let _ = (
            &self.files,
            &self.file_handles,
            &self.lock_handles,
            &self.read_bytes,
        );
        todo!()
    }

    fn get_files(&self) -> IndexMap<i64, String> {
        self.files.clone()
    }

    fn read_and_write(&mut self, _blocking: bool, _close: bool) -> IndexMap<i64, String> {
        todo!()
    }

    fn have_read_support(&self) -> bool {
        self.have_read_support
    }

    fn are_open(&self) -> bool {
        !self.inner.pipes.is_empty() && !self.file_handles.is_empty()
    }

    fn close(&mut self) {
        self.inner.close();
        todo!()
    }

    fn pipes(&self) -> &IndexMap<i64, PhpResource> {
        &self.inner.pipes
    }

    fn pipes_mut(&mut self) -> &mut IndexMap<i64, PhpResource> {
        &mut self.inner.pipes
    }
}