GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: execute shell directly for refresh() · nodejs/node@de77371

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/common
    • tmpdir.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/common/tmpdir.js‎

Copy file name to clipboardExpand all lines: test/common/tmpdir.js
+19-8Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@ const fs = require('fs');
55
const path = require('path');
66
const { pathToFileURL } = require('url');
77
const { isMainThread } = require('worker_threads');
8+
const isUnixLike = process.platform !== 'win32';
9+
let escapePOSIXShell;
810

911
function rmSync(pathname, useSpawn) {
1012
if (useSpawn) {
11-
const escapedPath = pathname.replaceAll('\\', '\\\\');
12-
spawnSync(
13-
process.execPath,
14-
[
15-
'-e',
16-
`require("fs").rmSync("${escapedPath}", { maxRetries: 3, recursive: true, force: true });`,
17-
],
18-
);
13+
if (isUnixLike) {
14+
escapePOSIXShell ??= require('./index.js').escapePOSIXShell;
15+
for (let i = 0; i < 3; i++) {
16+
const { status } = spawnSync(...escapePOSIXShell`rm -rf "${pathname}"`);
17+
if (status === 0) {
18+
break;
19+
}
20+
}
21+
} else {
22+
spawnSync(
23+
process.execPath,
24+
[
25+
'-e',
26+
`fs.rmSync(${JSON.stringify(pathname)}, { maxRetries: 3, recursive: true, force: true });`,
27+
],
28+
);
29+
}
1930
} else {
2031
fs.rmSync(pathname, { maxRetries: 3, recursive: true, force: true });
2132
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.