@tishlang/tish-format 3.12.0 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/tish-format CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "tishlang_fmt"
3
- version = "3.12.0"
3
+ version = "3.12.1"
4
4
  edition = "2021"
5
5
  description = "Opinionated formatter for Tish source (parse → pretty-print)"
6
6
  license-file = { workspace = true }
@@ -108,6 +108,7 @@ pub fn spawn_children(n: usize) -> io::Result<Vec<Child>> {
108
108
  let mut out = Vec::with_capacity(n - 1);
109
109
  for i in 1..n {
110
110
  let mut cmd = Command::new(&exe);
111
+ crate::no_console_window(&mut cmd);
111
112
  cmd.args(&args);
112
113
  cmd.env("TISH_WORKER_ID", i.to_string());
113
114
  cmd.env("TISH_HTTP_PREFORK", "child");
@@ -1013,6 +1013,20 @@ pub fn process_cwd(_args: &[Value]) -> Value {
1013
1013
  }
1014
1014
 
1015
1015
  #[cfg(feature = "process")]
1016
+ /// Windows: a child spawned from a GUI-subsystem parent (a desktop app) gets its own console
1017
+ /// window unless created with CREATE_NO_WINDOW — a packaged app spawning git / node / shell
1018
+ /// helpers at boot flashed a terminal window per child and stole focus. No-op elsewhere.
1019
+ #[cfg(windows)]
1020
+ pub fn no_console_window(cmd: &mut std::process::Command) -> &mut std::process::Command {
1021
+ use std::os::windows::process::CommandExt;
1022
+ const CREATE_NO_WINDOW: u32 = 0x0800_0000;
1023
+ cmd.creation_flags(CREATE_NO_WINDOW)
1024
+ }
1025
+ #[cfg(not(windows))]
1026
+ pub fn no_console_window(cmd: &mut std::process::Command) -> &mut std::process::Command {
1027
+ cmd
1028
+ }
1029
+
1016
1030
  pub fn process_exec(args: &[Value]) -> Value {
1017
1031
  use std::process::Command;
1018
1032
  let cmd = args
@@ -1022,7 +1036,7 @@ pub fn process_exec(args: &[Value]) -> Value {
1022
1036
  if cmd.is_empty() {
1023
1037
  return Value::Number(0.0);
1024
1038
  }
1025
- match Command::new("sh").arg("-c").arg(&cmd).status() {
1039
+ match no_console_window(Command::new("sh").arg("-c").arg(&cmd)).status() {
1026
1040
  Ok(status) => Value::Number(status.code().unwrap_or(1) as f64),
1027
1041
  Err(_) => Value::Number(1.0),
1028
1042
  }
@@ -1046,7 +1060,7 @@ pub fn process_exec_file(args: &[Value]) -> Value {
1046
1060
  Some(Value::Array(a)) => a.borrow().iter().map(|v| v.to_display_string()).collect(),
1047
1061
  _ => Vec::new(),
1048
1062
  };
1049
- match Command::new(&program).args(&argv).status() {
1063
+ match no_console_window(Command::new(&program).args(&argv)).status() {
1050
1064
  Ok(status) => Value::Number(status.code().unwrap_or(1) as f64),
1051
1065
  Err(_) => Value::Number(1.0),
1052
1066
  }
@@ -1093,7 +1107,7 @@ pub fn process_exec_capture(args: &[Value]) -> Value {
1093
1107
  if cmd.is_empty() {
1094
1108
  return process_capture_obj(0, String::new(), String::new());
1095
1109
  }
1096
- process_capture_result(Command::new("sh").arg("-c").arg(&cmd).output())
1110
+ process_capture_result(no_console_window(Command::new("sh").arg("-c").arg(&cmd)).output())
1097
1111
  }
1098
1112
 
1099
1113
  /// `process.execFileCapture(program, [args])` — run a program directly, WITHOUT a shell, capturing
@@ -1115,7 +1129,7 @@ pub fn process_exec_file_capture(args: &[Value]) -> Value {
1115
1129
  Some(Value::Array(a)) => a.borrow().iter().map(|v| v.to_display_string()).collect(),
1116
1130
  _ => Vec::new(),
1117
1131
  };
1118
- process_capture_result(Command::new(&program).args(&argv).output())
1132
+ process_capture_result(no_console_window(Command::new(&program).args(&argv)).output())
1119
1133
  }
1120
1134
 
1121
1135
  #[cfg(all(test, feature = "process", unix))]
@@ -198,6 +198,7 @@ pub fn process_spawn(args: &[Value]) -> Value {
198
198
  };
199
199
 
200
200
  let mut cmd = Command::new(program);
201
+ crate::no_console_window(&mut cmd);
201
202
  if let Some(Value::Array(a)) = obj_field(opts, "args") {
202
203
  for v in a.borrow().iter() {
203
204
  cmd.arg(v.to_display_string());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tishlang/tish-format",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "description": "Tish code formatter",
5
5
  "license": "PIF",
6
6
  "repository": {
Binary file
Binary file
Binary file
Binary file
Binary file