Update index.js
Browse files
index.js
CHANGED
|
@@ -7,8 +7,7 @@ import * as prb from 'puppeteer-real-browser'
|
|
| 7 |
import serveIndex from 'serve-index'
|
| 8 |
|
| 9 |
import { spawn } from 'node:child_process'
|
| 10 |
-
import {
|
| 11 |
-
import { writeFile } from 'node:fs/promises'
|
| 12 |
import { tmpdir } from 'node:os'
|
| 13 |
import { env } from 'node:process'
|
| 14 |
import { setTimeout } from 'node:timers/promises'
|
|
@@ -121,10 +120,7 @@ app.get(
|
|
| 121 |
tmpDir,
|
| 122 |
Date.now()
|
| 123 |
)
|
| 124 |
-
const log =
|
| 125 |
-
file,
|
| 126 |
-
{ flags: 'a' }
|
| 127 |
-
)
|
| 128 |
const child = spawn(
|
| 129 |
cmd,
|
| 130 |
args,
|
|
@@ -135,12 +131,10 @@ app.get(
|
|
| 135 |
{ FORCE_COLOR: '0' }
|
| 136 |
),
|
| 137 |
shell: true,
|
| 138 |
-
stdio: ['ignore',
|
| 139 |
}
|
| 140 |
)
|
| 141 |
child.unref()
|
| 142 |
-
child.stderr.pipe(file)
|
| 143 |
-
child.stdout.pipe(file)
|
| 144 |
res.redirect(file)
|
| 145 |
}
|
| 146 |
)
|
|
|
|
| 7 |
import serveIndex from 'serve-index'
|
| 8 |
|
| 9 |
import { spawn } from 'node:child_process'
|
| 10 |
+
import { open, writeFile } from 'node:fs/promises'
|
|
|
|
| 11 |
import { tmpdir } from 'node:os'
|
| 12 |
import { env } from 'node:process'
|
| 13 |
import { setTimeout } from 'node:timers/promises'
|
|
|
|
| 120 |
tmpDir,
|
| 121 |
Date.now()
|
| 122 |
)
|
| 123 |
+
const log = await open(file, 'w+')
|
|
|
|
|
|
|
|
|
|
| 124 |
const child = spawn(
|
| 125 |
cmd,
|
| 126 |
args,
|
|
|
|
| 131 |
{ FORCE_COLOR: '0' }
|
| 132 |
),
|
| 133 |
shell: true,
|
| 134 |
+
stdio: ['ignore', log, log]
|
| 135 |
}
|
| 136 |
)
|
| 137 |
child.unref()
|
|
|
|
|
|
|
| 138 |
res.redirect(file)
|
| 139 |
}
|
| 140 |
)
|