diff --git a/Cargo.lock b/Cargo.lock index 28548ab84c..e9ca3591d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1677,7 +1677,7 @@ dependencies = [ "serde", "thiserror 1.0.64", "winapi", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1767,7 +1767,7 @@ dependencies = [ "tokio", "uuid", "winapi", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1855,7 +1855,7 @@ dependencies = [ "log", "napi_sym", "thiserror 1.0.64", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1974,7 +1974,7 @@ dependencies = [ "url", "webpki-root-certs", "winapi", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "x25519-dalek", "x509-parser", "yoke", @@ -2174,7 +2174,7 @@ dependencies = [ "uuid", "which 4.4.2", "winapi", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2193,9 +2193,9 @@ dependencies = [ [[package]] name = "deno_task_shell" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e09966ce29f8d26b652a43355397e1df43b85759e7824196bf0ceaeaa9a2f4" +checksum = "fa3763bc068e17b6d488fb73ecda463c13ef792b0a5288b6018bc2119becd635" dependencies = [ "anyhow", "futures", @@ -2206,6 +2206,7 @@ dependencies = [ "path-dedot", "thiserror 1.0.64", "tokio", + "windows-sys 0.59.0", ] [[package]] @@ -4558,7 +4559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.4", + "windows-targets 0.48.5", ] [[package]] @@ -8623,7 +8624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.4", + "windows-targets 0.52.6", ] [[package]] @@ -8632,7 +8633,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.6", ] [[package]] @@ -8650,7 +8651,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -8670,17 +8680,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -8691,9 +8702,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -8703,9 +8714,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -8715,9 +8726,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -8727,9 +8744,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -8739,9 +8756,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -8751,9 +8768,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -8763,9 +8780,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" diff --git a/Cargo.toml b/Cargo.toml index 23670beec3..713b3ed1f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -239,7 +239,7 @@ nix = "=0.27.1" # windows deps junction = "=0.2.0" winapi = "=0.3.9" -windows-sys = { version = "0.52.0", features = ["Win32_Foundation", "Win32_Media", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_WindowsProgramming", "Wdk", "Wdk_System", "Wdk_System_SystemInformation", "Win32_Security", "Win32_System_Pipes", "Wdk_Storage_FileSystem", "Win32_System_Registry", "Win32_System_Kernel"] } +windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_Media", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_WindowsProgramming", "Wdk", "Wdk_System", "Wdk_System_SystemInformation", "Win32_Security", "Win32_System_Pipes", "Wdk_Storage_FileSystem", "Win32_System_Registry", "Win32_System_Kernel", "Win32_System_Threading", "Win32_UI", "Win32_UI_Shell"] } winres = "=0.1.12" [profile.release] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 4a343ce747..d8e59b5e35 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -83,7 +83,7 @@ deno_path_util.workspace = true deno_resolver.workspace = true deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_semver.workspace = true -deno_task_shell = "=0.20.1" +deno_task_shell = "=0.20.2" deno_telemetry.workspace = true deno_terminal.workspace = true libsui = "0.5.0" diff --git a/ext/io/bi_pipe.rs b/ext/io/bi_pipe.rs index 3492e2f441..bf65d3037f 100644 --- a/ext/io/bi_pipe.rs +++ b/ext/io/bi_pipe.rs @@ -407,7 +407,7 @@ pub fn bi_pipe_pair_raw( &s, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, - 0, + std::ptr::null_mut(), ); if hd2 == INVALID_HANDLE_VALUE { return Err(io::Error::last_os_error()); diff --git a/tests/specs/task/kill_task_windows_kills_children/__test__.jsonc b/tests/specs/task/kill_task_windows_kills_children/__test__.jsonc new file mode 100644 index 0000000000..f83d24e9aa --- /dev/null +++ b/tests/specs/task/kill_task_windows_kills_children/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "if": "windows", + "args": "run --check -A main.ts", + "output": "[WILDCARD]" // just ensure no failure +} diff --git a/tests/specs/task/kill_task_windows_kills_children/deno.jsonc b/tests/specs/task/kill_task_windows_kills_children/deno.jsonc new file mode 100644 index 0000000000..ee8102bed5 --- /dev/null +++ b/tests/specs/task/kill_task_windows_kills_children/deno.jsonc @@ -0,0 +1,5 @@ +{ + "tasks": { + "start": "deno run -A script.js" + } +} diff --git a/tests/specs/task/kill_task_windows_kills_children/main.ts b/tests/specs/task/kill_task_windows_kills_children/main.ts new file mode 100644 index 0000000000..351a7db6a3 --- /dev/null +++ b/tests/specs/task/kill_task_windows_kills_children/main.ts @@ -0,0 +1,75 @@ +class StdoutReader { + readonly #reader: ReadableStreamDefaultReader; + text = ""; + + constructor(stream: ReadableStream) { + const textStream = stream.pipeThrough(new TextDecoderStream()); + this.#reader = textStream.getReader(); + } + + [Symbol.dispose]() { + this.#reader.releaseLock(); + } + + async waitForText(waitingText: string) { + if (this.text.includes(waitingText)) { + return; + } + + while (true) { + const { value, done } = await this.#reader.read(); + if (value) { + this.text += value; + if (this.text.includes(waitingText)) { + break; + } + } + if (done) { + throw new Error("Did not find text: " + waitingText); + } + } + } +} + +const command = new Deno.Command("deno", { + args: ["task", "start"], + stdout: "piped", +}); + +const child = command.spawn(); + +const reader = new StdoutReader(child.stdout!); +console.log("Waiting..."); +await reader.waitForText("Ready"); +console.log("Received."); +const pid = parseInt(reader.text.split("\n")[0], 10); +console.log("PID", pid); +// ensure this function works +if (!isPidAlive(child.pid)) { + throw new Error("Unexpected."); +} +if (!isPidAlive(pid)) { + throw new Error("Unexpected."); +} +child.kill(); +// now the grandchild shouldn't be alive +if (isPidAlive(pid)) { + throw new Error("Unexpected."); +} + +function isPidAlive(pid: number) { + const command = new Deno.Command("cmd", { + args: ["/c", `wmic process where processid=${pid} get processid`], + }); + + try { + const { stdout } = command.outputSync(); // Execute the command + const output = new TextDecoder().decode(stdout); + + console.log("wmic output:", output.trim()); + return output.includes(pid.toString()); + } catch (error) { + console.error("Error checking PID:", error); + return false; + } +} diff --git a/tests/specs/task/kill_task_windows_kills_children/script.js b/tests/specs/task/kill_task_windows_kills_children/script.js new file mode 100644 index 0000000000..1a98d7280e --- /dev/null +++ b/tests/specs/task/kill_task_windows_kills_children/script.js @@ -0,0 +1,3 @@ +console.log(Deno.pid); +console.log("Ready"); +setInterval(() => {}, 10_000); // stay alive