Skip to content

Commit 2a90d43

Browse files
committed
fix: escape backslash-n in template literal to prevent SyntaxError in generated main.js
1 parent acaf604 commit 2a90d43

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎electerm-web/build/harmony/build.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function initLogFds () {
195195
try {
196196
fs.mkdirSync(dirs[i], { recursive: true })
197197
var fd = fs.openSync(path.join(dirs[i], 'main.log'), 'a')
198-
fs.writeSync(fd, '--- Log started ' + new Date().toISOString() + ' ---\n')
198+
fs.writeSync(fd, '--- Log started ' + new Date().toISOString() + ' ---\\n')
199199
_logFds.push(fd)
200200
} catch {}
201201
}
@@ -206,7 +206,7 @@ function logMsg () {
206206
if (typeof a === 'string') return a
207207
if (a && a.stack) return a.stack
208208
try { return JSON.stringify(a) } catch (e) { return String(a) }
209-
}).join(' ') + '\n'
209+
}).join(' ') + '\\n'
210210
console.log(msg)
211211
for (var i = 0; i < _logFds.length; i++) {
212212
try { fs.writeSync(_logFds[i], msg) } catch {}
@@ -310,9 +310,9 @@ function pollBackend () {
310310
if (pollCount > MAX_POLLS) {
311311
logMsg('Backend poll timeout after', MAX_POLLS, 'attempts. Backend did not start.')
312312
createErrorWindow(
313-
'Backend failed to start within 30 seconds.\n\n' +
314-
'Node.js: ' + (process.versions.node || 'unknown') + '\n' +
315-
'Electron: ' + (process.versions.electron || 'unknown') + '\n\n' +
313+
'Backend failed to start within 30 seconds.\\n\\n' +
314+
'Node.js: ' + (process.versions.node || 'unknown') + '\\n' +
315+
'Electron: ' + (process.versions.electron || 'unknown') + '\\n\\n' +
316316
'Check ~/electerm-logs/main.log for details.'
317317
)
318318
return

0 commit comments

Comments
 (0)