Skip to content

Commit 4760b7e

Browse files
author
Andrew
committed
feedback 2
1 parent 09b07ad commit 4760b7e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dsc_lib/src/dscresources/command_resource.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ pub fn invoke_resolve(resource: &ResourceManifest, cwd: &str, input: &str) -> Re
571571
///
572572
async fn run_process_async(executable: &str, args: Option<Vec<String>>, input: Option<&str>, cwd: Option<&str>, env: Option<HashMap<String, String>>, exit_codes: &Option<HashMap<i32, String>>) -> Result<(i32, String, String), DscError> {
573573

574+
// use somewhat large initial buffer to avoid early string reallocations;
575+
// the value is based on list result of largest of built-in adapters - WMI adapter ~500KB
576+
const INITIAL_BUFFER_CAPACITY: usize = 1024*1024;
577+
574578
let mut command = Command::new(executable);
575579
if input.is_some() {
576580
command.stdin(Stdio::piped());
@@ -618,10 +622,6 @@ async fn run_process_async(executable: &str, args: Option<Vec<String>>, input: O
618622
child.wait().await
619623
});
620624

621-
// use somewhat large initial buffer to avoid early string reallocations;
622-
// the value is based on list result of largest of built-in adapters - WMI adapter ~500KB
623-
const INITIAL_BUFFER_CAPACITY: usize = 1024*1024;
624-
625625
let stdout_task = tokio::spawn(async move {
626626
let mut stdout_result = String::with_capacity(INITIAL_BUFFER_CAPACITY);
627627
while let Ok(Some(line)) = stdout_reader.next_line().await {

0 commit comments

Comments
 (0)