MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

small tweaks for readline

+32 -2
+3 -1
src/modules/child_process.c
··· 1836 1836 1837 1837 ant_value_t child_process_library(ant_t *js) { 1838 1838 ant_value_t lib = js_mkobj(js); 1839 - ant_value_t exec_fn = js_mkfun(builtin_exec); 1839 + 1840 + ant_value_t exec_fn = js_heavy_mkfun(js, builtin_exec, js_mkundef()); 1840 1841 ant_value_t exec_file_fn = js_heavy_mkfun(js, builtin_execFile, js_mkundef()); 1842 + 1841 1843 child_process_init_constructor(js); 1842 1844 1843 1845 js_set_symbol(js, exec_fn,
+12
src/modules/readline.c
··· 342 342 343 343 static void handle_backspace(rl_interface_t *iface) { 344 344 if (iface->line_pos > 0) { 345 + if (iface->line_pos == iface->line_len) { 346 + iface->line_pos--; 347 + iface->line_len--; 348 + iface->line_buffer[iface->line_len] = '\0'; 349 + write_output(iface, "\b \b"); 350 + int cols = get_terminal_cols(); 351 + int prompt_len = (int)strlen(rl_render_prompt(iface)); 352 + int total_cols = prompt_len + iface->line_len; 353 + iface->last_render_rows = total_cols > 0 ? total_cols / cols + 1 : 1; 354 + return; 355 + } 356 + 345 357 memmove( 346 358 iface->line_buffer + iface->line_pos - 1, 347 359 iface->line_buffer + iface->line_pos,
+17 -1
tests/test_readline_question_prompt.cjs
··· 1 1 const { spawnSync } = require('child_process'); 2 + const fs = require('fs'); 2 3 const path = require('path'); 3 4 4 5 function fail(message) { 5 6 throw new Error(message); 7 + } 8 + 9 + function resolveExecutable(execPath) { 10 + if (path.isAbsolute(execPath)) return execPath; 11 + 12 + const localPath = path.resolve(execPath); 13 + if (fs.existsSync(localPath)) return localPath; 14 + 15 + for (const dir of (process.env.PATH || '').split(path.delimiter)) { 16 + if (!dir) continue; 17 + const candidate = path.join(dir, execPath); 18 + if (fs.existsSync(candidate)) return candidate; 19 + } 20 + 21 + return execPath; 6 22 } 7 23 8 24 function runInPty() { ··· 70 86 process.exit(0); 71 87 } 72 88 73 - return spawnSync('python3', ['-c', script, process.execPath, helper], { 89 + return spawnSync('python3', ['-c', script, resolveExecutable(process.execPath), helper], { 74 90 encoding: 'utf8', 75 91 timeout: 9000, 76 92 });